#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define lowbit(x) x & (-x);
#define inf 1e18
#define _inf -1e18
#define pyes cout << "YES" << endl
#define pno cout << "NO" << endl
#define inv(a) for (int& x: a) cin >> x;
#define llv(a) for (ll& x: a) cin >> x;
#define pri(a) for (int& x: a) cout << x << ' '
int const MOD = 998244353;
int const lg = 20;
int const block = 500;
// int block;
int const MAX = 1e3 + 1, N = 20;
int n, m, q, k, p;
int a[25][25];
void bexuyen67() {
cin >> n;
vector<int> a(n);
inv(a)
cin >> m;
vector<int> b(m);
inv(b)
vector<pii> scores;
for (int x: a){
scores.emplace_back(x, 0);
}
for (int x: b){
scores.emplace_back(x, 1);
}
int fh = 0, tur = 0;
sort(all(scores));
int cnta = 0, cntb = 0;
int pre = -1;
for (auto [score, type]: scores){
if (type){
cntb++;
}
else cnta++;
if (cnta > cntb){
if (pre == 1){
tur++;
}
pre = 0;
}
else if (cntb > cnta){
if (pre == 0){
tur++;
}
pre = 1;
}
if (score <= 1440)
fh++;
}
cout << fh << '\n' << tur;
}
signed main() {
#ifdef binhball
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(15);
int t = 1;
// cin >> t;
while (t--)
bexuyen67();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |