HNUST-1148 ACM ranking rules(简单模拟)
1148: ACM ranking rules
时间限制: 1 Sec 内存限制: 128 MB
提交: 16 解决: 12
[提交][状态][讨论版]
题目描述
ACM contests, like the one you are participating in, are hosted by the special software. That software, among other functions, preforms a job of accepting and evaluating teams' solutions (runs), and displaying results in a rank table. The scoring rules are as follows:
1. Each run is either accepted or rejected.
2. The problem is considered solved by the team, if one of the runs submitted for it is accepted.
3. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submission of the first accepted run for this problem (in minutes) plus 20 minutes for every other run for this problem before the accepted one. For an unsolved problem consumed time is not computed.
4. The total time is the sum of the time consumed for each problem solved.
5. Teams are ranked according to the number of solved problems. Teams that solve the same number of problems are ranked by the least total time.
6. While the time shown is in minutes, the actual time is measured to the precision of 1 second, and the the seconds are taken into account when ranking teams.
7. Teams with equal rank according to the above rules must be sorted by increasing team number.
Your task is, given the list of N runs with submission time and result of each run, compute the rank table for C teams.
输入
Input contains integer numbers C N, followed by N quartets of integers ci pi ti ri, where ci -- team number, pi -- problem number, ti -- submission time in seconds, ri -- 1, if the run was accepted, 0 otherwise.
1 ≤ C, N ≤ 1000, 1 ≤ ci ≤ C, 1 ≤ pi ≤ 20, 1 ≤ ti ≤ 36000.
输出
Output must contain C integers -- team numbers sorted by rank.
样例输入
3 3
1 2 3000 0
1 2 3100 1
2 1 4200 1
样例输出
2 1 3
提示
用结构体数组存储各队信息
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<map>
using namespace std; const int N = + ; int c, n;
struct node{
short _time = , solve = , num;
map<int, int> state;
}Node[N]; int main(){
scanf("%d %d", &c, &n);
for(int i = ; i <= c; i++) Node[i].num = i; int ci, pi, ti, ri;
for(int i = ; i <= n; i++){
scanf("%d %d %d %d", &ci, &pi, &ti, &ri);
auto & mp = Node[ci].state;
if(mp[pi] < ) continue;
if(ri == ) mp[pi]++;
if(ri == ) {
Node[ci]._time += (mp[pi] * * + ti);
mp[pi] = -;
Node[ci].solve++;
}
}
auto cmp = [](const node &x, const node &y) -> bool{
if(x.solve != y.solve) return x.solve > y.solve;
return x._time < y._time;
};
stable_sort(Node + , Node + n + , cmp);
for(int i = ; i <= n; i++){
printf("%d%c", Node[i].num, (i == n)?'\n':' ');
}
}
HNUST-1148 ACM ranking rules(简单模拟)的更多相关文章
- (hdu step 8.1.6)士兵队列训练问题(数据结构,简单模拟——第一次每2个去掉1个,第二次每3个去掉1个.知道队伍中的人数<=3,输出剩下的人 )
题目: 士兵队列训练问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- NYOJ 题目77 开灯问题(简单模拟)
开灯问题 时间限制:3000 ms | 内存限制:65535 KB 难度:1 描述 有n盏灯,编号为1~n,第1个人把所有灯打开,第2个人按下所有编号为2 ...
- HDU 4772 Zhuge Liang's Password (简单模拟题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4772 题面: Zhuge Liang's Password Time Limit: 2000/1000 ...
- java web学习总结(二十二) -------------------简单模拟SpringMVC
在Spring MVC中,将一个普通的java类标注上Controller注解之后,再将类中的方法使用RequestMapping注解标注,那么这个普通的java类就够处理Web请求,示例代码如下: ...
- WPF简单模拟QQ登录背景动画
介绍 之所以说是简单模拟,是因为我不知道QQ登录背景动画是怎么实现的.这里是通过一些办法把它简化了,做成了类似的效果 效果图 大体思路 首先把背景看成是一个4行8列的点的阵距,X轴Y轴都是距离70.把 ...
- Linux 内核 链表 的简单模拟(2)
接上一篇Linux 内核 链表 的简单模拟(1) 第五章:Linux内核链表的遍历 /** * list_for_each - iterate over a list * @pos: the & ...
- Linux 内核 链表 的简单模拟(1)
第零章:扯扯淡 出一个有意思的题目:用一个宏定义FIND求一个结构体struct里某个变量相对struc的编移量,如 struct student { int a; //FIND(struct stu ...
- JavaWeb学习总结(四十九)——简单模拟Sping MVC
在Spring MVC中,将一个普通的java类标注上Controller注解之后,再将类中的方法使用RequestMapping注解标注,那么这个普通的java类就够处理Web请求,示例代码如下: ...
- 简单模拟Hibernate的主要功能实现
在学习期间接触到Hibernate框架,这是一款非常优秀的O/R映射框架,大大简化了在开发web项目过程中对数据库的操作.这里就简单模拟其底层的实现. /*******代码部分,及其主要注解***** ...
随机推荐
- POJ 3068 运送危险化学品 最小费用流 模板题
"Shortest" pair of paths Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1215 ...
- ztree复选框
var setting = { check: { enable: true // chkboxType : { "Y" : "", "N" ...
- Spring boot之使用thymeleaf
操作步骤 (1)在pom.xml中引入thymeleaf; (2)如何关闭thymeleaf缓存 (3)编写模板文件.html (4)编写访问模板文件controller 在pom.xml中引入thy ...
- Java并发编程的艺术笔记(七)——CountDownLatch、CyclicBarrier详解
一.等待多线程完成的CountDownLatch CountDownLatch允许一个或多个线程等待其他线程完成操作,像加强版的join.(t.join()是等待t线程完成) 例: (1)开启多个线程 ...
- 第六周学习总结&第四次实验报告
第六周学习总结&第四次实验报告 学习总结 这周我们简单的学习了一点点关于接口的内容,接口是Java中最重要的概念之一,接口可以理解为一个特殊的类, 里面由全局常量和公共的抽象方法组成,接口摆脱 ...
- Java程序设计第十周学习总结
Java课程知识梳理: 流的区分; 字符流与字节流的区别: 字节流是直接操作文件本身的,如果没有关闭字节流操作,文件会依然输出内容 而字符流在程序运行之后会发现文件没有任何的内容,这是因为字符流操作的 ...
- DS博客大作业--树 (陈梓灿组)
1.树的存储结构说明 定义的结构体中,name是用于存放文件名称,string类型是字符串类型,定义了child孩子结点和brother兄弟结点. 2.树的函数说明 1.main函数 main函数中主 ...
- Git 合并两个分支内容
1,将开发分支代码合入到master中 git checkout dev #切换到dev开发分支 git pull git checkout master git merge dev #合并dev分支 ...
- spark 源码编译 standalone 模式部署
本文介绍如何编译 spark 的源码,并且用 standalone 的方式在单机上部署 spark. 步骤如下: 1. 下载 spark 并且解压 本文选择 spark 的最新版本 2.2.0 (20 ...
- Jmeter(五)检查点
录制的脚本回放成功了, 但是运行有可能出现失败的情况, 所以有必要让JMeter来帮我们验证测试结果的正确性. 在Jmeter中是用断言组件来实现此功能的. 首先, 在需要添加断言的请求后面, 添加响 ...