Submission #162012

# Submission time Handle Problem Language Result Execution time Memory
162012 2019-11-05T18:44:09 Z ToniB Preokret (COCI18_preokret) C++14
50 / 50
4 ms 376 KB
#include <iostream>

using namespace std;

int main(){
	int a, As, b, Bs, sol1 = 0, sol2 = 0, score1 = 0, score2 = 0;
	int winner = 0, pastwinner = 0;
	cin >> a;
	int Al[2880];
	int Bl[2880];
	
	for(int i = 0; i < 2880; i++){
		Al[i] = 0;
		Bl[i] = 0;
	}
	
	for(int i = 0; i < a; i++){
		cin >> As;
		if(As <= 1440){
			sol1 += 1;
		}
		Al[As] = 1;
		
	}

    cin >> b;
    
    for(int i = 0; i < b; i++){
    	cin >> Bs;
    	if(Bs <= 1440){
    		sol1 += 1;
		}
    	Bl[Bs] = 1;
	}
	
	
	for(int i = 0; i < 2880; i++){
		if(Al[i] == 1){
			score1 += 1;
		}
		if(Bl[i] == 1){
			score2 += 1;
		}
		
		pastwinner = winner;
		
		if(score1 < score2){
			winner = 2;
		}
		if(score2 < score1){
			winner = 1;
		}
		
				
		if(winner != pastwinner){
			sol2 += 1;
		}
		
		
	}
	
	cout << sol1 << endl;;
	cout << sol2 - 1;

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