답안 #222354

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222354 2020-04-13T05:11:00 Z tqbfjotld ACM (COCI19_acm) C++14
50 / 50
15 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int n,m;
vector<pair<pair<int,int>,string> >v;

int main(){
    cin>>n;
    cin>>m;
    for (int x = 0; x<n; x++){
        string name;
        cin>>name;
        if (name=="NijeZivotJedanACM"){
            for (int x = 0; x<m; x++){
                 string t;
                cin>>t;
            }

            continue;
        }
        int qnum = 0;
        int pen = 0;
        for (int x = 0; x<m; x++){
            string res;
            cin>>res;
            if (res[0]=='-'){
                continue;
            }
            if (res[0]=='+'||res[0]=='?'){
                qnum++;
                int sub = res[1]-'0';
                sub--;
                pen += 1200*sub;
                pen += 36000*(res[3]-'0');
                pen += 3600*(res[4]-'0');
                pen += 600*(res[6]-'0');
                pen += 60*(res[7]-'0');
                pen += 10*(res[9]-'0');
                pen += (res[10]-'0');
            }

        }
        qnum = -qnum;
        v.push_back({{qnum,pen},name});
    }
    string name;
    cin>>name;
    int qnum = 0;
    int pen = 0;
    for (int x = 0; x<m; x++){
        string res;
        cin>>res;
        if (res[0]=='-'){
            continue;
        }
        if (res[0]=='+'){
            qnum++;
            int sub = res[1]-'0';
            sub--;
            pen += 1200*sub;
            pen += 36000*(res[3]-'0');
            pen += 3600*(res[4]-'0');
            pen += 600*(res[6]-'0');
            pen += 60*(res[7]-'0');
            pen += 10*(res[9]-'0');
            pen += (res[10]-'0');
        }

    }
    qnum = -qnum;
    v.push_back({{qnum,pen},name});
    sort(v.begin(),v.end());
    int c = 1;
    for (auto x : v){
       // printf("%d %d\n",x.first.first,x.first.second);
        if (x.second=="NijeZivotJedanACM"){
            printf("%d",c);
            return 0;
        }
        c++;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 15 ms 384 KB Output is correct
5 Correct 14 ms 384 KB Output is correct