Submission #340246

# Submission time Handle Problem Language Result Execution time Memory
340246 2020-12-27T10:44:42 Z A_D ACM (COCI19_acm) C++14
0 / 50
7 ms 492 KB
/*
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;
            ll 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;
        ll 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

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 time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 6 ms 364 KB Output isn't correct
3 Incorrect 1 ms 492 KB Output isn't correct
4 Incorrect 7 ms 364 KB Output isn't correct
5 Incorrect 6 ms 364 KB Output isn't correct