Kattis - ACM Contest Scoring
ACM Contest Scoring
Our new contest submission system keeps a chronological log of all submissions made by each team during the contest. With each entry, it records the number of minutes into the competition at which the submission was received, the letter that identifies the relevant contest problem, and the result of testing the submission (designated for the sake of this problem simply as right or wrong). As an example, the following is a hypothetical log for a particular team:
3 E right
10 A wrong
30 C wrong
50 B wrong
100 A wrong
200 A right
250 C wrong
300 D right
The rank of a team relative to others is determined by a primary and secondary scoring measure calculated from the submission data. The primary measure is the number of problems that were solved. The secondary measure is based on a combination of time and penalties. Specifically, a team’s time score is equal to the sum of those submission times that resulted in right answers, plus a 20-minute penalty for each wrong submission of a problem that is ultimately solved. If no problems are solved, the time measure is 00.
In the above example, we see that this team successfully completed three problems: E on their first attempt (33 minutes into the contest); A on their third attempt at that problem (200200 minutes into the contest); and D on their first attempt at that problem (300300 minutes into the contest). This team’s time score (including penalties) is 543543. This is computed to include 33 minutes for solving E, 200200 minutes for solving A with an additional 4040 penalty minutes for two earlier mistakes on that problem, and finally 300300 minutes for solving D. Note that the team also attempted problems B and C, but were never successful in solving those problems, and thus received no penalties for those attempts.
According to contest rules, after a team solves a particular problem, any further submissions of the same problem are ignored (and thus omitted from the log). Because times are discretized to whole minutes, there may be more than one submission showing the same number of minutes. In particular there could be more than one submission of the same problem in the same minute, but they are chronological, so only the last entry could possibly be correct. As a second example, consider the following submission log:
7 H right
15 B wrong
30 E wrong
35 E right
80 B wrong
80 B right
100 D wrong
100 C wrong
300 C right
300 D wrong
This team solved 4 problems, and their total time score (including penalties) is 502502, with 77 minutes for H, 35+2035+20 for E, 80+4080+40 for B, and 300+20300+20 for C.
Input
The input contains nn lines for 0≤n≤1000≤n≤100, with each line describing a particular log entry. A log entry has three parts: an integer mm, with 1≤m≤3001≤m≤300, designating the number of minutes at which a submission was received, an uppercase letter designating the problem, and either the word right or wrong. The integers will be in nondecreasing order and may contain repeats. After all the log entries is a line containing just the number −1−1.
Output
Output two integers on a single line: the number of problems solved and the total time measure (including penalties).
Sample Input 1 | Sample Output 1 |
---|---|
3 E right |
3 543 |
Sample Input 2 | Sample Output 2 |
---|---|
7 H right |
4 502 |
题意
每道题错一次加20的罚时,如果这道题没做对的话就不算,求做对的题数和总时间
思路
用一个数组记录题目出现的次数,然后遍历的时候如果结果是“right”的话,就加上(所用的时间+出现的次数-1*20);
#include<bits/stdc++.h>
using namespace std;
struct Node {
int score;
char ch;
string answer;
} aa[]; int main() {
int x;
char c;
string ss;
int t = ;
for(int i = ; i < ; i++) {
aa[i].score = ;
}
int bb[] = {};
while(cin >> x) {
if(x != -) {
cin >> c;
cin >> ss;
bb[c]++;
if(ss == "right")
aa[c].score += x;
aa[c].ch = c;
aa[c].answer = ss;
t++;
} else
break;
}
int cnt = , sum = ;
for(int i = ; i <= ; i++) {
if(aa[i].answer == "right") {
cnt++;
sum += aa[i].score + (bb[i] - ) * ;
}
}
printf("%d %d\n", cnt, sum);
return ;
}
Kattis - ACM Contest Scoring的更多相关文章
- SDUT 2409:The Best Seat in ACM Contest
The Best Seat in ACM Contest Time Limit: 1000MS Memory limit: 65536K 题目描述 Cainiao is a university st ...
- Sdut 2409 The Best Seat in ACM Contest(山东省第三届ACM省赛 H 题)(模拟)
题目描述 Cainiao is a university student who loves ACM contest very much. It is a festival for him once ...
- 牛客-https://www.nowcoder.com/acm/contest/96/H
链接:https://www.nowcoder.com/acm/contest/96/H来源:牛客网 题目描述 今天qwb要参加一个数学考试,这套试卷一共有n道题,每道题qwb能获得的分数为ai,qw ...
- UVA10600:ACM Contest and Blackout(次小生成树)
ACM Contest and Blackout 题目链接:https://vjudge.net/problem/UVA-10600 Description: In order to prepare ...
- UVA10600 ACM Contest and Blackout —— 次小生成树
题目链接:https://vjudge.net/problem/UVA-10600 In order to prepare the “The First National ACM School Con ...
- UVA 10600 ACM Contest and Blackout 次小生成树
又是求次小生成树,就是求出最小生成树,然后枚举不在最小生成树上的每条边,求出包含着条边的最小生成树,然后取一个最小的 #include <iostream> #include <al ...
- 【UVA 10600】 ACM Contest and Blackout(最小生成树和次小生成树)
[题意] n个点,m条边,求最小生成树的值和次小生成树的值. InputThe Input starts with the number of test cases, T (1 < T < ...
- [ An Ac a Day ^_^ ] [kuangbin带你飞]专题八 生成树 UVA 10600 ACM Contest and Blackout 最小生成树+次小生成树
题意就是求最小生成树和次小生成树 #include<cstdio> #include<iostream> #include<algorithm> #include& ...
- uva 10600 ACM Contest And Blackout
题意: 求最小生成树和次小生成树的总权值. 思路: 第一种做法,适用于规模较小的时候,prim算法进行的时候维护在树中两点之间路径中边的最大值,复杂度O(n^2),枚举边O(m),总复杂度O(n^2) ...
随机推荐
- linux下查看mysql版本的四种方法
Linux查看MySQL版本的四种方法 1 在终端下执行 mysql -V 2 在help中查找 mysql --help |grep Distrib 3 在mysql 里查看 select vers ...
- android的listview的addheaderView总是出现空指针的错误
android的listview的addheaderView总是出现空指针的错误, 网上的处理方法如下: // This doesn't work... nullPointerException Li ...
- Vue JsonView 树形格式化代码插件
组件代码(临时粘出来) <template> <div class="bgView"> <div :class="['json-view' ...
- 训练1-Z
有一头母牛,它每年年初生一头小母牛.每头小母牛从第四个年头开始,每年年初也生一头小母牛.请编程实现在第n年的时候,共有多少头母牛? Input 输入数据由多个测试实例组成,每个测试实例占一行,包括一个 ...
- FFMpeg 常用命令格式转换,视频合成
FFmpeg都是命令行的,用起来肯定不方便.但是,这对技术宅应该不成问题.下面,我就罗列一些比较实用的使用方法吧. FFmpeg的下载与安装 FFmpeg是开源的.但我们不必去下载它的源代码.下载已经 ...
- Django安装部署
MVC模式说明 Model:是应用程序中用于处理应用程序数据逻辑的部分,通常模型对象负责在数据库中存取数据 View: 是应用程序中处理数据显示的部分,通常视图是依据模型数据创建的 Controlle ...
- Java启动问题-Application Server was not connected before run configuration stop, reason: Unable to ping server at localhost:1099
环境一直跑的挺好的,突然报这么一个错误,百思不得其解. 网上查询之后才想起来,自己当时为了IE能运行浪潮服务器的远程console,将环境变量里面的java换成了32位版本的. 修改jre版本与环境变 ...
- struts配置问题
- WifiManager类具体解释
public class WifiManager extends Object java.lang.Object ↳ android.net.wifi.WifiManager 类概述 This ...
- SSD纠错码向LDPC码演变
作者:Stephen Bates SSD控制器芯片中採用的纠错编码(ECCs)的类型正在发生一场演变.相信很多这篇博文的读者对此都有所了解.传统上採用的纠错码是基于群变换的博斯-查德胡里-霍昆格母(B ...