Submission #162131

# Submission time Handle Problem Language Result Execution time Memory
162131 2019-11-06T15:49:26 Z Doda Preokret (COCI18_preokret) C++14
6.2 / 50
5 ms 376 KB
#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 (int h= f; h<3000 ; h++){
	if (arr[h] > bar[h]) {
		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[h] > arr[h]){
		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;
}
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 376 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 2 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 5 ms 376 KB Output isn't correct
10 Correct 3 ms 376 KB Output is correct