# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
701696 | 2023-02-22T01:30:55 Z | scottchou | Preokret (COCI18_preokret) | C++17 | 1 ms | 340 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 320 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 328 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |