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)递推. ...
随机推荐
- VS2010 MFC对话框程序用CButtonST给按钮添加图标
也许是VS版本的关系,CButtonST中的BCMenu两个文件是无法编译通过的. 1.拷贝下载的CButtonST(我下载的v3.9)中的BtnST.h和BtnST.cpp文件到自己项目目录下. ...
- 说说wee sing(ZZ)
我自己在当当上买过wee sing,也在网上下了wee sing 的DVD,也借过同事在淘宝上买的Wee sing 套装(9cd + 5DVD).所以对这套资料还是很熟悉的. 淘宝上的套装卖 ...
- 2018.06.29 洛谷P2890 [USACO07OPEN]便宜的回文(简单dp)
P2890 [USACO07OPEN]便宜的回文Cheapest Palindrome 时空限制 1000ms / 128MB 题目描述 Keeping track of all the cows c ...
- =default(c++11)
1.概念 1)如果我们需要编译器默认的行为,则可以在参数列表后面加上=default来显式地要求编译器生成合成版本的默认构造函数和拷贝控制成员:合成的默认构造函数.合成拷贝构造函数.合成拷贝赋值运算符 ...
- Netty学习第六节实例一步学习
NIO与传统IO对应使用的类: ServerSocketChannel相当于ServerSocket SocketChannel 相当于Socket Selector是NIO的核心类,是负责监听Ser ...
- (网络流) Sabotage -- UVA -- 10480
链接: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82835#problem/J 代码: #include<cstdio> ...
- hdu 3664 Permutation Counting(水DP)
Permutation Counting Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
- queued frame 造成图形性能卡顿
曾经遇到过卡顿是类似的原因:当时对显卡底层知识理解不懂,看到引擎底层有一个MaxFramexxx的接口,实现是使用注册表修改显卡底层的注册信息,当时还是一个掉接口习惯的客户端码农的思维,没理解底层含义 ...
- PO Release Final Closed 灾难恢复
今天不小心 Final Closed了一条Po Release,只能通过后台更新数据恢复了. 更新后可接收可匹配,但不保证更新数据有遗漏,慎用. 更新前备份各表数据 UPDATE PO_LINE_LO ...
- 通过css使用background-color为背景图添加遮罩效果
一个div同时设置background-color和background-image的话,color是处于img层下方的,无法实现遮罩效果,所以需要再创建一个div作为其子div,然后设置子div的背 ...