| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 86097 | ffrich | Preokret (COCI18_preokret) | C++14 | 3 ms | 596 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>
#include<algorithm>
#include<cstdio>
#include<vector>
using namespace std;
	vector < pair < int , int > > lebronzejames;
	
int main(){
	int ans1 = 0, ans2 = 0;
	int A; cin >> A;
	for(int i = 0; i < A; i++){
		int min; cin >> min;
		if(min <= 1440) ans1++;
		lebronzejames.push_back(make_pair(min,1));
	}
	int B; cin >> B;
	for(int i = 0; i < B; i++){
		int min; cin >> min;
		if(min <= 1440) ans1++;
		lebronzejames.push_back(make_pair(min,-1));
	} sort(lebronzejames.begin(),lebronzejames.end());
	
	int lastdiff = 0;
	int vodstvo = 0;
	for(int i = 0; i < A+B; i++){
		
		lastdiff += lebronzejames[i].second;
		if(lastdiff > 0 && vodstvo == -1){
			ans2++;
			vodstvo = 1;
		}
		else if(lastdiff < 0 && vodstvo == 1){
			ans2++;
			vodstvo = -1;
		}
		else if(lastdiff > 0 && vodstvo == 0) vodstvo = 1;
		else if(lastdiff < 0 && vodstvo == 0) vodstvo = -1;
		
	} cout << ans1 << endl << ans2;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
