Submission #222405

# Submission time Handle Problem Language Result Execution time Memory
222405 2020-04-13T06:36:29 Z lyc ACM (COCI19_acm) C++14
20 / 50
8 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i, a, b) for (int i=a;i>=b;--i)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, M; cin >> N >> M;
    vector<tuple<int,int,string,string>> teams;
    FOR(i,1,N){
        string T; cin >> T;
        int solved = 0, ptime = 0;
        FOR(j,1,M){
            string task; cin >> task;
            if (task[0] == '-') continue;
            ++solved;
            ptime = (task[1]-'1') * 20 * 60;

            //cout << "T " << T << " TASK " << task << endl;
            int hh = stoi(task.substr(3,2)), mm = stoi(task.substr(6,2)), ss = stoi(task.substr(9,2));
            ptime += hh * 60 * 60 + mm * 60 + ss;
        }

        string S(T);
        FOR(i,0,SZ(S)) S[i] = tolower(S[i]);
        teams.emplace_back(-solved,ptime,S,T);
    }

    string T; cin >> T;
    int solved = 0, ptime = 0;
    FOR(j,1,M){
        string task; cin >> task;
        if (task[0] == '-') continue;
        ++solved;
        ptime = (task[1]-'1') * 20 * 60;

        int hh = stoi(task.substr(3,2)), mm = stoi(task.substr(6,2)), ss = stoi(task.substr(9,2));
        ptime += hh * 60 * 60 + mm * 60 + ss;
    }

    for (auto& x : teams) {
        if (get<3>(x) == T) {
            get<0>(x) = -solved;
            get<1>(x) = ptime;
            break;
        }
    }

    sort(teams.begin(),teams.end());
    //for(auto&x :teams){
    //    cout << get<3>(x) << " :: " << get<0>(x) << " " << get<1>(x) << endl;
    //}

    FOR(i,0,SZ(teams)-1){
        if (get<3>(teams[i]) == T) {
            cout << i+1;
            return 0;
        }
    }
}

# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 7 ms 512 KB Output isn't correct
3 Correct 5 ms 384 KB Output is correct
4 Incorrect 8 ms 512 KB Output isn't correct
5 Incorrect 8 ms 512 KB Output isn't correct