Submission #711607

#TimeUsernameProblemLanguageResultExecution timeMemory
711607scottchouACM (COCI19_acm)C++17
50 / 50
2 ms340 KiB
#include<bits/stdc++.h> using namespace std; int const N = 1005; struct Person{ string name; int p = 0, ac, id; }a[N]; bool cmp(Person& x, Person& y){ if(x.ac != y.ac) return x.ac > y.ac; if(x.p != y.p) return x.p < y.p; return x.name < y.name; } int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; int nij = -1; for(int i = 0; i < n; i++){ cin >> a[i].name; string st; a[i].id = i; if(a[i].name == "NijeZivotJedanACM"){ nij = i; for(int j = 0; j < m; j++){ cin >> st; } continue; } for(int j = 0; j < m; j++){ cin >> st; if(st[0] == '-') continue; a[i].ac++; a[i].p += (st[1] - '0' - 1) * 1200; a[i].p += (st[4] - '0') * 3600 + (st[6] - '0') * 600 + (st[7] - '0') * 60 + (st[9] - '0') * 10 + (st[10] - '0'); } } cin >> a[nij].name; string st; for(int j = 0; j < m; j++){ cin >> st; if(st[0] == '-') continue; a[nij].ac++; a[nij].p += (st[1] - '0' - 1) * 1200; a[nij].p += (st[4] - '0') * 3600 + (st[6] - '0') * 600 + (st[7] - '0') * 60 + (st[9] - '0') * 10 + (st[10] - '0'); } sort(a, a + n, cmp); for(int i = 0; i < n; i++){ if(a[i].id == nij){ cout << i + 1 << '\n'; break; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...