# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
228935 | VEGAnn | Preokret (COCI18_preokret) | C++14 | 5 ms | 384 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>
using namespace std;
const int N = 3010;
int ans = 0, vl[N], A, B;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> A;
for (int i = 0; i < A; i++){
int x; cin >> x;
vl[x] = 1;
}
cin >> B;
for (int i = 0; i < B; i++){
int x; cin >> x;
vl[x] = -1;
}
for (int tim = 1; tim <= 1440; tim++)
ans += abs(vl[tim]);
cout << ans << '\n';
ans = 0;
int lst = 0, cur = 0;
for (int tim = 1; tim <= 2880; tim++){
cur += vl[tim];
if (cur != 0){
if (lst != 0){
if (lst > 0 && cur < 0)
ans++;
if (lst < 0 && cur > 0)
ans++;
}
lst = cur;
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |