# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
176083 | Doda | Preokret (COCI18_preokret) | C++14 | 2 ms | 376 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 <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
long long a,b,as[3000],bs[3000],pp,najma=5000,najb=5000,pr,preokret,vodi,pv;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> a;
for (int i = 1;i<=a;i++){
long long r;
cin >> r;
as[r] = 1;
if (r<1441)
pp++;
if (najma>r)
najma = r;
}
cin >> b;
for (int i = 1;i<=b;i++){
long long r;
cin >> r;
bs[r] = 1;
if (r<1441)
pp++;
if (najb>r)
najb = r;
}
long long najm;
if (najma>najb)
najm = b;
else
najm = a;
for (int i = najm;i<=2880;i++){
if (as[i] != 0 || bs[i] != 0){
if (as[i] == 1)
pr++;
if (bs[i] == 1)
pr--;
if (pr >= 1)
vodi = 1;
if (pr <= -1)
vodi = -1;
if (pv != vodi)
preokret++;
pv = vodi;
}
}
cout << pp << endl << preokret-1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |