# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
701696 | scottchou | Preokret (COCI18_preokret) | C++17 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n;
vector<pair<int, bool> > a;
int x, cnt = 0;
for(int i = 0; i < n; i++){
cin >> x;
if(x <= 1440)
cnt++;
a.push_back({x, 0});
}
cin >> m;
for(int i = 0; i < m; i++){
cin >> x;
if(x <= 1440)
cnt++;
a.push_back({x, 1});
}
sort(a.begin(), a.end());
cout << cnt << '\n';
int aa = !a[0].second, bb = a[0].second;
bool now_win = a[0].second;
int cnt2 = 0;
for(int i = 1; i < a.size(); i++){
aa += !a[i].second; bb += a[i].second;
if((aa > bb && now_win) || (aa < bb && !now_win)){
cnt2++;
now_win = !now_win;
}
}
cout << cnt2 << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |