# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171253 | makotako | Preokret (COCI18_preokret) | C++14 | 4 ms | 504 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>
#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], s[H], 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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |