답안 #711608

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711608 2023-03-17T09:43:02 Z Pring ACM (COCI19_acm) C++14
40 / 50
4 ms 1108 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
typedef std::pair<int, int> pii;

const int MXN = 1005, MXM = 15;
int n, m, heroID, sc[MXN];

int f(char c) {
    return c - '0';
}

int t2i(string &s) {
    return (f(s[0]) * 10 + f(s[1])) * 3600 + (f(s[3]) * 10 + f(s[4])) * 60 + (f(s[6]) + f(s[7]));
}

struct Score {
    string name;
    string status[MXM];
    int WA[MXM], time[MXM], AC, p;
    Score() {
        name = "";
        fill(status, status + MXM, "");
        fill(WA, WA + MXM, 0);
        fill(time, time + MXM, 0);
        AC = 0;
        p = 0;
    }
    void PROCESS() {
        for (int i = 0; i < m; i++) {
            if (status[i][0] == '-') continue;
            int slash = status[i].find('/');
            string ts = status[i].substr(slash + 1, status[i].size() - slash - 1);
            AC++;
            p += (status[i][1] - '1') * 1200;
            p += t2i(ts);
        }
    }
};

Score board[MXN], hero;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> board[i].name;
        for (int j = 0; j < m; j++) {
            cin >> board[i].status[j];
        }
        if (board[i].name == "NijeZivotJedanACM") heroID = i;
    }
    cin >> hero.name;
    for (int i = 0; i < m; i++) cin >> hero.status[i];
    swap(board[heroID], hero);
    for (int i = 0; i < n; i++) {
        board[i].PROCESS();
    }
    sort(board, board + n, [](Score &a, Score &b) {
        return (a.AC == b.AC ? (a.p == b.p ? (a.name < b.name) : (a.p < b.p)) : (a.AC > b.AC));
    });
    for (int i = 0; i < n; i++) {
        if (board[i].name == "NijeZivotJedanACM") {
            cout << i + 1 << endl;
            return 0;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 4 ms 1108 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 4 ms 1108 KB Output is correct
5 Incorrect 4 ms 1108 KB Output isn't correct