#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int A, B;
bool As[3000] = {}, Bs[3000] = {};
cin >> A;
for (int i = 0; i < A; ++i) {
int s;
cin >> s;
As[s] = true;
}
cin >> B;
for (int i = 0; i < B; ++i) {
int s;
cin >> s;
Bs[s] = true;
}
int ans1 = 0, ans2 = 0;
int Ascore = 0, Bscore = 0;
bool af = false, bf = false;
for (int s = 1; s <= 4*12*60; ++s) {
if (As[s]) {
++Ascore;
if (s <= 2*12*60) {
++ans1;
}
}
if (Bs[s]) {
++Bscore;
if (s <= 2*12*60) {
++ans1;
}
}
if (!af && !bf) {
if (Ascore > Bscore) {
bf = true;
} else {
af = true;
}
}
if (af && Ascore > Bscore) {
++ans2;
af = false;
bf = true;
}
if (bf && Ascore < Bscore) {
++ans2;
af = true;
bf = false;
}
}
cout << ans1 << '\n' << ans2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |