Submission #245221

#TimeUsernameProblemLanguageResultExecution timeMemory
245221penguinhackerACM (COCI19_acm)C++17
0 / 50
8 ms384 KiB
//ACM #include <bits/stdc++.h> using namespace std; #define ll long long #define ar array int n, m; vector<pair<pair<int, int>, string>> team; void re(pair<int, int> &p) { string t; cin >> t; if (t[0]=='-') return; ++p.first; p.second+=t[1]-'1'; } bool srt(pair<pair<int, int>, string> a, pair<pair<int, int>, string> b) { assert(a.second!=b.second); if (a.first.first!=b.first.first) return a.first.first<b.first.first; if (a.first.second!=b.first.second) return a.first.second<b.first.second; return a.second<b.second; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int i=0; i<=n; ++i) { string name; cin >> name; pair<int, int> p={0, 0}; for (int j=0; j<m; ++j) { re(p); } if (i<n&&name=="NijeZivotJedanACM") continue; team.push_back({p, name}); } assert((int)team.size()==n); sort(team.begin(), team.end(), srt); for (int i=0; i<n; ++i) { if (team[i].second=="NijeZivotJedanACM") { cout << i+1; break; } } return 0; } /* stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN */
#Verdict Execution timeMemoryGrader output
Fetching results...