Submission #711607

# Submission time Handle Problem Language Result Execution time Memory
711607 2023-03-17T09:42:24 Z scottchou ACM (COCI19_acm) C++17
50 / 50
2 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
int const N = 1005;
struct Person{
    string name;
    int p = 0, ac, id;
}a[N];
bool cmp(Person& x, Person& y){
    if(x.ac != y.ac)
        return x.ac > y.ac;
    if(x.p != y.p)
        return x.p < y.p;
    return x.name < y.name;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    int nij = -1;
    for(int i = 0; i < n; i++){
        cin >> a[i].name;
        string st;
        a[i].id = i;
        if(a[i].name == "NijeZivotJedanACM"){
            nij = i;
            for(int j = 0; j < m; j++){
                cin >> st;
            }
            continue;
        }
        for(int j = 0; j < m; j++){
            cin >> st;
            if(st[0] == '-')
                continue;
            a[i].ac++;
            a[i].p += (st[1] - '0' - 1) * 1200;
            a[i].p += (st[4] - '0') * 3600 + (st[6] - '0') * 600 + (st[7] - '0') * 60 + (st[9] - '0') * 10 + (st[10] - '0');
        }
    }
    cin >> a[nij].name;
    string st;
    for(int j = 0; j < m; j++){
        cin >> st;
        if(st[0] == '-')
            continue;
        a[nij].ac++;
        a[nij].p += (st[1] - '0' - 1) * 1200;
        a[nij].p += (st[4] - '0') * 3600 + (st[6] - '0') * 600 + (st[7] - '0') * 60 + (st[9] - '0') * 10 + (st[10] - '0');
    }
    sort(a, a + n, cmp);
    for(int i = 0; i < n; i++){
        if(a[i].id == nij){
            cout << i + 1 << '\n';
            break;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct