# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
222348 | 2020-04-13T05:02:34 Z | dantoh000 | ACM (COCI19_acm) | C++14 | 19 ms | 768 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 16 ms | 640 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 19 ms | 768 KB | Output is correct |
5 | Correct | 18 ms | 768 KB | Output is correct |