제출 #1331731

#제출 시각아이디문제언어결과실행 시간메모리
1331731benjaminshihPreokret (COCI18_preokret)C++20
50 / 50
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int cnt = 0;
    int a_score;
    cin >> a_score;
    vector<int> at(a_score);
    for(auto &x : at) cin >> x;
    int b_score;
    cin >> b_score;
    vector<int> bt(b_score);
    vector<int> prefa(2882,0),prefb(2882,0);

    for(int i = 0 ; i < a_score ; i++){
        if(at[i] <= 1440) cnt++;
        prefa[at[i]]++;
    }

    for(auto &x : bt) cin >> x;
    for(int i = 0 ; i < b_score ; i++){
        if(bt[i] <= 1440) cnt++;
        prefb[bt[i]]++;
    }
    for(int i = 1 ; i <= 2880 ; i++){
        prefa[i] += prefa[i-1];
    }
    for(int i = 1 ; i <= 2880 ; i++){
        prefb[i] += prefb[i-1];
    }
    int win = 0;
    int change = 0;

    int pa = 0 , pb = 0;
    for(int i = 1 ; i <= 2880 ; i++){
        if(prefa[i] > prefb[i]){

            if(win == 2) change++;
            win = 1;
        }
        else if(prefb[i] > prefa[i]){

            if(win == 1) change++;
            win = 2;
        }

    }
    cout << cnt << '\n' << change;
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...