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
10 A wrong
30 C wrong
50 B wrong
100 A wrong
200 A right
250 C wrong
300 D right
-1
3 543
Sample Input 2 Sample Output 2
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
-1
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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 牛客-https://www.nowcoder.com/acm/contest/96/H

    链接:https://www.nowcoder.com/acm/contest/96/H来源:牛客网 题目描述 今天qwb要参加一个数学考试,这套试卷一共有n道题,每道题qwb能获得的分数为ai,qw ...

  4. UVA10600:ACM Contest and Blackout(次小生成树)

    ACM Contest and Blackout 题目链接:https://vjudge.net/problem/UVA-10600 Description: In order to prepare ...

  5. UVA10600 ACM Contest and Blackout —— 次小生成树

    题目链接:https://vjudge.net/problem/UVA-10600 In order to prepare the “The First National ACM School Con ...

  6. UVA 10600 ACM Contest and Blackout 次小生成树

    又是求次小生成树,就是求出最小生成树,然后枚举不在最小生成树上的每条边,求出包含着条边的最小生成树,然后取一个最小的 #include <iostream> #include <al ...

  7. 【UVA 10600】 ACM Contest and Blackout(最小生成树和次小生成树)

    [题意] n个点,m条边,求最小生成树的值和次小生成树的值. InputThe Input starts with the number of test cases, T (1 < T < ...

  8. [ An Ac a Day ^_^ ] [kuangbin带你飞]专题八 生成树 UVA 10600 ACM Contest and Blackout 最小生成树+次小生成树

    题意就是求最小生成树和次小生成树 #include<cstdio> #include<iostream> #include<algorithm> #include& ...

  9. uva 10600 ACM Contest And Blackout

    题意: 求最小生成树和次小生成树的总权值. 思路: 第一种做法,适用于规模较小的时候,prim算法进行的时候维护在树中两点之间路径中边的最大值,复杂度O(n^2),枚举边O(m),总复杂度O(n^2) ...

随机推荐

  1. MongoDB_基础知识

    mongoDB术语:database-数据库,collection-数据库表/集合,document-数据记录行/文档,field-数据字段/域,index-索引,primary key-主键(Mon ...

  2. java 常用API 包装 练习

    package com.oracel.demo01; import java.util.Random; public class Swzy { public static void main(Stri ...

  3. TensorFlow+实战Google深度学习框架学习笔记(12)------Mnist识别和卷积神经网络LeNet

    一.卷积神经网络的简述 卷积神经网络将一个图像变窄变长.原本[长和宽较大,高较小]变成[长和宽较小,高增加] 卷积过程需要用到卷积核[二维的滑动窗口][过滤器],每个卷积核由n*m(长*宽)个小格组成 ...

  4. 【图像处理】使用OpenCV实现人脸和行人检测

      OpenCV全称是Open source Computer Vision Library(开放源代码计算机视觉库),是一个用于图像处理.分析.机器视觉方面的开源函数库,提供了很多图像处理的工具和可 ...

  5. Project Euler 47 Distinct primes factors( 筛法记录不同素因子个数 )

    题意: 首次出现连续两个数均有两个不同的质因数是在: 14 = 2 × 715 = 3 × 5 首次出现连续三个数均有三个不同的质因数是在: 644 = 22 × 7 × 23645 = 3 × 5 ...

  6. 51nod-独木舟问题

    n个人,已知每个人体重,独木舟承重固定,每只独木舟最多坐两个人,可以坐一个人或者两个人.显然要求总重量不超过独木舟承重,假设每个人体重也不超过独木舟承重,问最少需要几只独木舟?分析:  一个显然的策略 ...

  7. Problem 5

    Problem 5 # Problem_5.py """ 2520 is the smallest number that can be divided by each ...

  8. Myeclipse学习总结(5)——Myeclipse常用快捷键再学习

    Ctrl+1 快速修复 Ctrl+D: 删除当前行  Ctrl+Q 定位到最后编辑的地方  Ctrl+L 定位在某行  Ctrl+O 快速显示 OutLine  Ctrl+T 快速显示当前类的继承结构 ...

  9. 公司组织oracle培训的理解

    oracle执行机制 1.客户端发送一条sql给oracle服务器,oracle会看这条sql的执行计划是否存在缓存  如果存在则直接运行,如果不存在执行第二步. 2.如果不存在缓存 则会 进行语法检 ...

  10. hdu 3836 强连通+缩点:加边构强连通

    #include<stdio.h>//求出其所有的强连通分量缩点,选出出度和入度最大的那个就是要求的边 #include<string.h> #include<stdli ...