# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162130 | Doda | Preokret (COCI18_preokret) | C++14 | 3 ms | 380 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>
using namespace std;
int arr [3000];
int brr [3000];
int bar [3000];
int d = 0;
int g = 0;
int pr = 0;
int vodi = 0;
int u1 = 0;
int u2 = 0;
int pa = 0;
int pc = 0;
int pv = 0;
int p = 1;
int m = -1;
int o = 0;
int v1 = 0;
int v2 = 0;
int a,b,l,c,f ;
int main () {
cin >> a;
for (int i = 0; i<a; i++) {
cin >> arr[i];
if (arr[i]<1440) {
pa++;
}
l = arr[i];
arr[l] = l;
arr[i] = 0;
}
cin >> b ;
for (int i = 0; i<b; i++) {
cin >> bar[i];
if (bar[i]<1440) {
pc++;
}
l = bar[i];
bar[l] = l;
bar[i] = 0;
}
c = a+b ;
//cout << arr[35]<< "\n";
//cout << arr[3]<< "\n";
int z = 0 ;
for (int k=0; k<2881;k++){
if (arr[k]>bar[k]){
v1 ++;
v2 --;
vodi = p;
z=k;
break;
}
if (bar[k]>arr[k]){
v1 --;
v2 ++ ;
vodi = m;
z=k;
break;
}
}
f = z+1 ;
for (f; f<3000 ; f++){
if (arr[f] > bar[f]) {
if (vodi == o) {
if (v2 == o) {
pv += p;
vodi = p;
v1 ++;
v2 --;
}
if (vodi == m){
vodi = 0;
v1 ++;
v2 --;
}
if (vodi == p){
v1 ++;
v2 --;
}
}
if (bar[f] > arr[f]){
if (vodi == o){
if (v1 == o){
pv += p;
vodi = m;
v1 --;
v2 ++;
}
}
if (vodi == p){
vodi = 0;
v1 --;
v2 ++;
}
if (vodi == m){
v1--;
v2++;
}
}
}
}
cout << pa + pc << "\n";
cout << pv;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |