# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88129 | BabinSinko | Preokret (COCI18_preokret) | C++14 | 3 ms | 812 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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
using namespace std;
int na, a[2883], nb, b[2883], sol1, sol2, ba, bb, sl[2883], j;
int main(){
cin >> na;
for(int i = 0; i < na; i++){
cin >> a[i];
if (a[i] <= 1440)
sol1 = sol1 + 1;
}
cin >> nb;
for(int i = 0; i < nb; i++){
cin >> b[i];
if (b[i] <= 1440)
sol1 = sol1 + 1;
}
for(int i = 1; i <= 2883; i++){
if (a[ba] == i){
sl[j] = 1;
j = j + 1;
ba = ba + 1;
}
if (b[bb] == i){
sl[j] = 2;
j = j + 1;
bb = bb + 1;
}
}
ba = 0;
bb = 0;
for (int i = 0; i < (na + nb); i++){
if(sl[i] == 1){
ba = ba + 1;
}
if(sl[i] == 2){
bb = bb + 1;
}
if(ba == (bb - 1) and sl[i + 1] == 1 and sl[i + 2] == 1)
sol2 = sol2 + 1;
if(bb == (ba - 1) and sl[i + 1] == 2 and sl[i + 2] == 2)
sol2 = sol2 + 1;
}
cout << sol1 << endl << sol2;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |