답안 #500566

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500566 2021-12-31T11:32:52 Z kappa Preokret (COCI18_preokret) C++14
50 / 50
1 ms 332 KB
#include <bits/stdc++.h>

using namespace std;

int a, b, suma, sumb, trn, half;

priority_queue<pair<int, int> > pq;

int main(){
    cin >> a;

    while(a--){
        int t;
        cin >> t;
        pq.push({-t, 0});
    }

    cin >> b;

    while(b--){
        int t;
        cin >> t;
        pq.push({-t, 1});
    }

    int kayb = -1;

    while(!pq.empty()){
        pair<int, int> curr = pq.top();
        pq.pop();

        if(-curr.first <= 1440) half++;

        if(curr.second == 0){
            suma++;
        }else{
            sumb++;
        }

        if(kayb == 0 && suma > sumb) trn++;
        else if(kayb == 1 && sumb > suma) trn++;

        if(suma != sumb) kayb = suma > sumb;
    }

    cout << half << "\n" << trn;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 288 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 296 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 204 KB Output is correct