Submission #258885

#TimeUsernameProblemLanguageResultExecution timeMemory
258885itiamACM (COCI19_acm)C++11
50 / 50
11 ms512 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define parii pair<int,int> vector <pair<parii,string>> v; string nasTim="NijeZivotJedanACM"; int n,m; int struint(string a){ int x=0; for (auto w: a) x=x*10+w-'0'; return x; } parii racun(){ int cnt=0, pen=0; string zad; for (int i=0;i<m;i++){ cin >> zad; if (zad[0]!='-'){ cnt++; pen+=(zad[1]-'0'-1)*1200; int h=struint(zad.substr(3,2)); int m=struint(zad.substr(6,2)); int sek=struint(zad.substr(9,2)); pen+=h*3600+m*60+sek; } } return {-cnt, pen}; } int main(){ string ime; cin >> n >> m; for (int i=0;i<n+1;i++){ cin >> ime; auto r=racun(); if (ime!=nasTim) v.pb({r,ime}); else if(i==n) v.pb({r,ime}); } sort(v.begin(),v.end()); for (int i=0;i<v.size();i++){ if(v[i].second==nasTim){ cout << i+1;break;}} return 0; }

Compilation message (stderr)

acm.cpp: In function 'int main()':
acm.cpp:44:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<v.size();i++){    if(v[i].second==nasTim){ cout << i+1;break;}}
                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...