Submission #245220

#TimeUsernameProblemLanguageResultExecution timeMemory
245220penguinhackerACM (COCI19_acm)C++17
0 / 50
8 ms616 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(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 */

Compilation message (stderr)

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from acm.cpp:2:
acm.cpp: In function 'int main()':
acm.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  assert(team.size()==n);
         ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...