Submission #87187

# Submission time Handle Problem Language Result Execution time Memory
87187 2018-11-29T23:17:06 Z jvalsortav Preokret (COCI18_preokret) C++14
50 / 50
4 ms 544 KB
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>

using namespace std;

int a, b, x, br, ba, bb, y;
set <int> ak, bk;
int aj = 1, bj  = 0;

int main() {
	
	cin >> a;
	
	for (int i = 0; i < a; i++){
		cin >> x;
		ak.insert(x);
		if (x <= 1440) br++;
	}
	
	cin >> b;
	
	for (int i = 0; i < b; i++){
		cin >> x;
		bk.insert(x);
		if (x <= 1440) br++;
	}
	
	x = *ak.begin();
	y = *bk.begin();
	
	if (x > y){
		/*ba++;
		ak.erase(x);*/
	}
	else{
		/*bb++;
		bk.erase(y);*/
		aj = 0;
		bj = 1;
	}
	y = 0;
	
	for (int i = 0; i < 2880; i++){
		if (ak.count(i)) ba++;
		if (bk.count(i)) bb++;
		
		if (aj){
			if (ba < bb){
				aj = 0;
				bj = 1;
				y++;
			}
		}
		if (bj){
			if (bb < ba){
				aj = 1;
				bj = 0;
				y++;
			}
		}
	}
	
	cout << br << endl << y-1;
	
	

return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 408 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Correct 3 ms 544 KB Output is correct
8 Correct 4 ms 544 KB Output is correct
9 Correct 3 ms 544 KB Output is correct
10 Correct 2 ms 544 KB Output is correct