-
Notifications
You must be signed in to change notification settings - Fork 0
/
acm.cpp
76 lines (64 loc) · 1.89 KB
/
acm.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <bits/stdc++.h>
using namespace std;
int main()
{
map<char, int> problemToScore; // Stores the current score for a problem
map<char, bool> solved; // Stores whether a problem has been solved
int right = 0; // Number of right solutions
int total = 0; // Total score of right solutions
// Until EOF
while(true)
{
// Get the time
int time;
cin >> time;
// If EOF
if(time == -1)
{
break;
}
// Get the problem
char problem;
cin >> problem;
// Get the verdict
string verdict;
cin >> verdict;
// If the problem is solved
if(verdict == "right")
{
solved[problem] = true; // Set the problem as solved
// If there haven't been any wrong submissions
if(problemToScore.count(problem) == 0)
{
// Set the score to the time
problemToScore[problem] = time;
}
// If there have been wrong submissions
else
{
// Add the time to the penalty time
problemToScore[problem] += time;
}
right++; // Increment number of problems solved
total += problemToScore[problem]; // Add the score to the total
}
// If the ssssolution is wrong
else
{
// If there are no penalties for this problem so far
if(problemToScore.count(problem) == 0)
{
// Start the score at 20
problemToScore[problem] = 20;
}
// If there are penalties for this problem already
else
{
// Add an extra penalty time
problemToScore[problem] += 20;
}
}
}
cout << right << " " << total << endl;
return 0;
}