# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222348 | dantoh000 | ACM (COCI19_acm) | C++14 | 19 ms | 768 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
unordered_map<string,int> score;
unordered_map<string,int> penalty;
string names[1005];
int time(string s){
int h = 0, m = 0, S = 0;
h = s[0]*10 + s[1];
m = s[3]*10 + s[4];
S = s[5]*10 + s[6];
return h*60*60 + m*60 + S;
}
int process(string name, string s){
//cout << name << " " << s << endl;
if (s[0] == '-') return 0;
if (s[0] == '+' || s[0] == '?'){
score[name]++;
int num = s[1];
penalty[name] += num*20*60;
string k = "";
for (int i = 3; i < s.size(); i++) k += s[i];
int t = time(k);
penalty[name] += t;
}
}
bool compare(string a, string b){
if (score[a] == score[b]) return penalty[a] < penalty[b];
else return score[a] > score[b];
}
int main(){
int n,m;
scanf("%d%d",&n,&m);
for (int i = 0; i < n; i++){
string name;
cin >> name;
names[i] = name;
for (int j = 0; j < m; j++){
string s;
cin >> s;
process(name,s);
}
}
string name;
cin >> name;
score[name] = 0;
penalty[name] = 0;
for (int j = 0; j < m; j++){
string s;
cin >> s;
process(name,s);
}
int ans = 1;
for (int i = 0; i < n; i++){
if (compare(names[i],name)) ans++;
}
printf("%d",ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |