#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define N int(1e5) + 5
#define T int(1e4) + 55
#define H int(1e3) + 55
using namespace std;
ll n, m, a[H * 3 ], s[H * 3], sum, num, sam, nam;
int main() {
cin >> n;
for(int i = 1;i <= n; ++ i) {
cin >> a[i];
if(a[i] <= 24 * 60) {
sum ++;
}
}
cin >> m;
for(int i = 1;i <= m; ++ i) {
cin >> s[i];
if(s[i] <= 24 * 60) {
sum ++;
}
}
cout << sum << endl;
sum = 0;
sam = 1;
nam = 1;
ll sam1 = 0, nam1 = 0;
while(sam <= n || nam <= m) {
if(a[sam] < s[nam] && sam <= n) {
sam ++;
if(sam1 == 0 && nam1 == 0) {
sam1 = 1;
}
else if(nam1 == 1 && sam > nam) {
nam1 = 0;
sam1 = 1;
sum ++;
}
}
else {
nam ++;
if(sam1 == 0 && nam1 == 0) {
nam1 = 1;
}
else if(sam1 == 1 && nam > sam) {
sam1 = 0;
nam1 = 1;
sum ++;
}
}
}
cout << sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
296 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Partially correct |
5 ms |
376 KB |
Output is partially correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Partially correct |
2 ms |
252 KB |
Output is partially correct |
9 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Correct |
2 ms |
376 KB |
Output is correct |