#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
preokret.cpp: In function 'int main()':
preokret.cpp:70:7: warning: statement has no effect [-Wunused-value]
for (f; f<3000 ; f++){
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
256 KB |
Output is partially correct |
2 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
3 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
4 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
5 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
6 |
Partially correct |
3 ms |
376 KB |
Output is partially correct |
7 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
8 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |