POJ 2379
#include <iostream>
#include <algorithm>
#define MAXN 1005
using namespace std; struct node
{
bool p[];
int sum;
int pre_sum[];
int num_pro;
int team;
}; node _m[MAXN]; struct node_1
{
int k[];
}; node_1 in[MAXN]; int test;
int num;
bool op(node a,node b); void init();
bool op_1(node_1 a,node_1 b);
int main()
{
int i;
int j;
int team;
int pro;
int time;
int res;
//freopen("acm.acm","r",stdin);
cin>>num>>test;
for(i = ; i < test; ++ i)
{
for(j = ; j < ; ++ j)
{
cin>>in[i].k[j];
}
} sort(in,in+test,op_1); init(); for(i = ; i < test; ++ i)
{
team = in[i].k[];
pro = in[i].k[];
time = in[i].k[];
res = in[i].k[];
if(_m[team].p[pro] == false)
{
if(res == )
{
_m[team].pre_sum[pro] += ;
}
else
{
_m[team].sum += time;
_m[team].sum += _m[team].pre_sum[pro];
++ _m[team].num_pro;
_m[team].p[pro] = true;
}
}
}
sort(_m+,_m+num+,op);
for(i = ; i < num; ++ i)
{
cout<<_m[i].team<<" ";
}
cout<<_m[i].team;
} bool op_1(node_1 a,node_1 b)
{
if(a.k[] < b.k[])
return true;
return false;
} bool op(node a,node b)
{
if(a.num_pro > b.num_pro)
{
return true;
}
else if(a.num_pro == b.num_pro)
{
if(a.sum < b.sum)
return true;
else if(a.sum == b.sum)
{
if(a.team < b.team)
return true;
else
return false;
}
else
return false;
}
else
return false;
} void init()
{
int i;
int j;
for(i = ; i <= num; ++ i)
{
for(j = ; j < ; ++ j)
{
_m[i].p[j] = false;
_m[i].pre_sum[j] = ;
}
_m[i].team = i;
_m[i].sum = ;
_m[i].num_pro = ;
}
}
POJ 2379的更多相关文章
- POJ 2379 ACM Rank Table(排序)
题很水,数据注意一下四点即可: 1.有些team会在一道题AC了之后还提交,这个时候只需要算第一次ac的时间以及这之前的wa,之后的全部忽略.2.如果一道题没有ac,那么在计算时间时不应该加上它的wa ...
- poj 2379 Sum of Consecutive Prime Numbers
...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
- (转)POJ题目分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
- poj分类
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- poj 题目分类(1)
poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...
- poj 1106 Transmitters (叉乘的应用)
http://poj.org/problem?id=1106 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4488 A ...
- POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)
本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...
- POJ题目分类(转)
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
随机推荐
- 2018.10.16 spoj Can you answer these queries V(线段树)
传送门 线段树经典题. 就是让你求左端点在[l1,r1][l1,r1][l1,r1]之间,右端点在[l2,r2][l2,r2][l2,r2]之间且满足l1≤l2,r1≤r2l1\le l2,r1 \l ...
- 被弃用的php函数以及被那个代替
原文链接 http://blog.csdn.net/a11085013/article/details/8937848 下面列举了部分被弃用的函数: call_user_method ...
- phalapi框架where条件查询
// WHERE name = 'dogstar' AND age = 18 $user->where(array('name' => 'dogstar', 'age' => 18) ...
- VHDL数据类型
VHDL表示16进制 如 a : std_logic_vector(7 downto 0) 把0x55赋给a a <= x"55"; b表示二进制 b“1011_1111” ...
- 16)maven lifecycle
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html http://maven.apache.o ...
- AME
http://wenku.baidu.com/view/a9dbebc789eb172ded63b7f4.htmlhttp://wenku.baidu.com/view/dde6eb040740be1 ...
- iOS Development和iOS Distribution有什么区别
http://zhidao.baidu.com/link?url=T9od33JuA7jjxzfyV-wOjuVLSNUaqpc9aoCu2HjfYfHBuRLW1CNDii0Bh9uvG6h-GeJ ...
- html.EditorForModel自定义模版
https://www.cnblogs.com/lori/p/5969658.html http://www.cnblogs.com/yinzixin/archive/2012/12/18/2821 ...
- Python学习-2.安装IDE
Python安装包中已经包含了一个IDE了,叫IDLE,可以在Python的安装目录内找到路径为 ./Lib/idlelib/idle.bat 或者可以在开始菜单中找到. 但是这个IDE功能很弱,缺少 ...
- A SQL to insert continuous values
I need a table to store all the working days. I dont like loop, so I tried sql. The following is the ...