Submission #340242

#TimeUsernameProblemLanguageResultExecution timeMemory
340242A_DACM (COCI19_acm)C++14
0 / 50
7 ms492 KiB
/* ID: antwand1 TASK: barn1 LANG: C++ */ #include <bits/stdc++.h> #define ll long long #define du long double #define F first #define S second using namespace std; const int N=1e3+100; string f="NijeZivotJedanACM"; pair<pair<ll,ll>,string> a[N]; main() { //freopen("barn1.in","r",stdin);freopen("barn1.out","w",stdout); int n,m; cin>>n>>m; int cu=0; for(int i=1;i<=n;i++){ string res; cin>>res; if(res==f){ cu=i; } ll ad=0,pen=0; for(int j=1;j<=m;j++){ ll ben=0; string t; cin>>t; if(t[0]=='-')continue; ad++; ll q=0; reverse(t.begin(),t.end()); t.pop_back(); while(t.back()!='/'){ ben*=10; ben+=t.back()-'0'; t.pop_back(); } t.pop_back(); ben*=20*60; int h=(t[0]-'0')*10+(t[1]-'0'); ben+=h*3600; t.pop_back();t.pop_back();t.pop_back(); h=(t[0]-'0')*10+(t[1]-'0'); ben+=h*60; t.pop_back();t.pop_back();t.pop_back(); h=(t[0]-'0')*10+(t[1]-'0'); ben+=h; pen+=ben; } a[i]={{-ad,pen},res}; } string res; cin>>res; int i=cu; ll ad=0,pen=0; for(int j=1;j<=m;j++){ ll ben=0; string t; cin>>t; if(t[0]=='-')continue; ad++; ll q=0; reverse(t.begin(),t.end()); t.pop_back(); while(t.back()!='/'){ ben*=10; ben+=t.back()-'0'; t.pop_back(); } t.pop_back(); ben*=20*60; int h=(t[0]-'0')*10+(t[1]-'0'); ben+=h*3600; t.pop_back();t.pop_back();t.pop_back(); h=(t[0]-'0')*10+(t[1]-'0'); ben+=h*60; t.pop_back();t.pop_back();t.pop_back(); h=(t[0]-'0')*10+(t[1]-'0'); ben+=h; pen+=ben; } a[i]={{-ad,+pen},res}; sort(a+1,a+n+1); for(int i=1;i<=n;i++){ // cout<<a[i].F.F<<" "<<a[i].F.S<<" "<<a[i].S<<endl; if(a[i].S==f){ cout<<i<<endl; //break; } } }

Compilation message (stderr)

acm.cpp:15:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main()
      |      ^
acm.cpp: In function 'int main()':
acm.cpp:34:16: warning: unused variable 'q' [-Wunused-variable]
   34 |             ll q=0;
      |                ^
acm.cpp:66:12: warning: unused variable 'q' [-Wunused-variable]
   66 |         ll q=0;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...