Submission #245225

#TimeUsernameProblemLanguageResultExecution timeMemory
245225penguinhackerACM (COCI19_acm)C++14
50 / 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; int toInt(string s) { int res=0, mult=1; for (int i=(int)s.size()-1; ~i; --i) res+=mult*(s[i]-'0'), mult*=10; return res; } int parse(string s) { int res=3600*toInt(s.substr(0, 2)); res+=60*toInt(s.substr(3, 2)); res+=toInt(s.substr(6, 2)); return res; } void re(pair<int, int> &p) { string s; cin >> s; if (s[0]=='-') return; ++p.first; p.second+=(s[1]-'1')*1200; p.second+=parse(s.substr(3, 8)); } 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}); } //for (auto x : team) // cout << x.first.first << ' ' << x.first.second << ' ' << x.second << '\n'; assert((int)team.size()==n); sort(team.begin(), team.end(), srt); //for (auto x : team) // cout << x.first.first << ' ' << x.first.second << ' ' << x.second << '\n'; 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...