답안 #711593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711593 2023-03-17T09:30:57 Z becaido ACM (COCI19_acm) C++17
50 / 50
2 ms 468 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

const int SIZE = 1005;

int n, m;

struct ds {
    string name;
    int ac, penalty;
    bool operator < (const ds& rhs) const {
        return ac != rhs.ac ? ac > rhs.ac : penalty != rhs.penalty ? penalty < rhs.penalty : name < rhs.name;
    }
} a[SIZE];

int num(string s) {
    int re = 0;
    for (char c : s) re = 10 * re + c - '0';
    return re;
}

pair<int, int> result() {
    int ac = 0, penalty = 0;
    FOR (i, 1, m) {
        string s;
        cin >> s;
        if (s[0] == '-') continue;
        ac++;
        penalty += (s[1] - '1') * 1200 + 3600 * num(s.substr(3, 2)) + 60 * num(s.substr(6, 2)) + num(s.substr(9, 2));
    }
    return {ac, penalty};
}

void solve() {
    cin >> n >> m;
    FOR (i, 1, n) {
        cin >> a[i].name;
        tie(a[i].ac, a[i].penalty) = result();
    }
    string s;
    cin >> s;
    FOR (i, 1, n) if (a[i].name == s) tie(a[i].ac, a[i].penalty) = result();
    sort(a + 1, a + n + 1);
    FOR (i, 1, n) if (a[i].name == s) {
        cout << i << '\n';
        return;
    }
}

int main() {
    Waimai;
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 468 KB Output is correct