| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 160788 | socho | Preokret (COCI18_preokret) | C++14 | 3 ms | 380 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 "bits/stdc++.h"
using namespace std;
int main() {
    
    vector<pair<int, int> > evt;
    
    int a;
    cin >> a;
    for (int i=0; i<a; i++) {
		int t;
		cin >> t;
		evt.push_back(make_pair(t, 0));
	}
	
	int b;
    cin >> b;
    for (int i=0; i<b; i++) {
		int t;
		cin >> t;
		evt.push_back(make_pair(t, 1));
	}
	
	sort(evt.begin(), evt.end());
	
	int ac = 0;
	int bc = 0;
	int fh = 0;
	
	vector<int> lead;
	
	for (int i=0; i<evt.size(); i++) {
		int tm = evt[i].first;
		int si = evt[i].second;
		
		if (tm <= 1440) fh++;
		
		if (si == 0) ac++;
		else bc++;
		
		if (ac > bc) {
			lead.push_back(0);
		}
		else if (bc > ac) {
			lead.push_back(1);
		}
	}
	
	int ta = 0;
	for (int i=0; i<lead.size()-1; i++) {
		if (lead[i] != lead[i+1]) ta++;
	}
	
	cout << fh << endl << ta << endl;
	
	
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
