Submission #576348

#TimeUsernameProblemLanguageResultExecution timeMemory
576348AGEACM (COCI19_acm)C++14
50 / 50
26 ms31872 KiB
#include <bits/stdc++.h> #define int long long #define F first #define S second #define pb push_back using namespace std; const int N=1e6,M=3e3+2,mod=1e9+7; int a[N]; string ss[N]; int num[N],ans[N]; main() { int n,m; cin>>n>>m; int index; for(int i=0; i<n; i++) { cin>>ss[i]; for(int j=0; j<m; j++) { string s; cin>>s; if(ss[i]=="NijeZivotJedanACM"){ index=i; continue; } if(s[0]=='-') { continue; } else { num[i]++; ans[i]+=1200*(s[1]-'0'); ans[i]+=(s[4]-'0')*3600; int x=s[6]-'0'; x*=10; x+=(s[7]-'0'); ans[i]+=x*60; x=s[9]-'0'; x*=10; x+=(s[10]-'0'); ans[i]+=x; } } num[i]=-num[i]; } string sss; cin>>sss; for(int j=0; j<m; j++) { string s; cin>>s; if(s[0]=='-'||s[0]=='?') { continue; } else { num[index]++; ans[index]+=1200*(s[1]-'0'); ans[index]+=(s[4]-'0')*3600; int x=s[6]-'0'; x*=10; x+=(s[7]-'0'); ans[index]+=x*60; x=s[9]-'0'; x*=10; x+=(s[10]-'0'); ans[index]+=x; } } num[index]=-num[index]; int ansindex; vector< pair< int, pair<int,string > > >v; for(int i=0; i<n; i++){ v.pb({num[i],{ans[i],ss[i]}}); } sort(v.begin(),v.end()); for(int i=0; i<v.size(); i++) { if(v[i].S.S=="NijeZivotJedanACM") ansindex=i; } cout<<ansindex+1<<endl; return 0; }

Compilation message (stderr)

acm.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main()
      | ^~~~
acm.cpp: In function 'int main()':
acm.cpp:110:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, std::pair<long long int, std::__cxx11::basic_string<char> > > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  110 |     for(int i=0; i<v.size(); i++)
      |                  ~^~~~~~~~~
acm.cpp:117:20: warning: 'ansindex' may be used uninitialized in this function [-Wmaybe-uninitialized]
  117 |     cout<<ansindex+1<<endl;
      |                    ^
acm.cpp:99:30: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
   99 |         num[index]=-num[index];
      |                     ~~~~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...