답안 #222504

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222504 2020-04-13T08:30:18 Z lyc ACM (COCI19_acm) C++14
50 / 50
9 ms 640 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>> teams;
    FOR(i,1,N){
        string name; cin >> name;
        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 * 3600 + mm * 60 + ss;
        }
        if (name != "NijeZivotJedanACM") {
            teams.emplace_back(-solved,ptime,name);
        }
    }

    string name; cin >> name;
    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 * 3600 + mm * 60 + ss;
    }
    teams.emplace_back(-solved,ptime,name);

    sort(teams.begin(),teams.end());

    FOR(i,0,SZ(teams)-1){
        if (get<2>(teams[i]) == name) {
            cout << i+1 << '\n';
            return 0;
        }
    }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 7 ms 640 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 8 ms 512 KB Output is correct
5 Correct 9 ms 512 KB Output is correct