137282025-01-08 14:52:04Leventusz09Találkozáscpp17Wrong answer 2/55216ms15800 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

using namespace std;
/*
struct Event{
	int time;
	bool type;
	Event(int time, bool type) {
		this->time = time;
		this->type = type;
	}
};

bool sortEvent(Event a, Event b) {
	return a.time < b.time;
}*/

int main() {
	int N;
	cin >> N;

	map<int, vector<bool>> events;
	set<int> pts;
	vector<int> ts;

	//vector<Event> events;

	for (int i = 0, érk, táv; i < N; i++) {
		cin >> érk >> táv;
		events[érk].push_back(1);
		events[táv].push_back(0);
		
		pts.insert(érk);
		pts.insert(táv);

		//ts.push_back(érk);
		//ts.push_back(táv);
		//events.push_back(Event(érk, 1));
		//events.push_back(Event(táv, 1));
	}

	for (auto i : pts) ts.push_back(i);

	//sort(ts.begin(), ts.end());

	int c = 0, i = 0, j = 0;
	int max = c, maxi = i, maxj = j;
	while (true){
		if (c >= 3) {
			maxi = i;
			maxj = j;

			i++;
			//if (i > ts.size() - 1) break;
			for(bool e : events[ts[i-1]]) if (!e) c--;
		}else{
			j++;
			if (j > ts.size()) break;
			for(bool e: events[ts[j-1]])  if (e) c++;
		}

		if (ts[i] == 9) {
			continue;
		}
	}

	cout << ts[maxj]+1-ts[maxi] << "\n" << ts[maxi] << " " << ts[maxj] << "\n";


	return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/55
1Wrong answer0/01ms316 KiB
2Time limit exceeded0/0206ms15592 KiB
3Partially correct1/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/22ms448 KiB
8Wrong answer0/31ms508 KiB
9Wrong answer0/31ms316 KiB
10Wrong answer0/32ms316 KiB
11Wrong answer0/313ms2164 KiB
12Wrong answer0/320ms3144 KiB
13Wrong answer0/321ms2940 KiB
14Wrong answer0/339ms4916 KiB
15Wrong answer0/339ms4928 KiB
16Wrong answer0/335ms4916 KiB
17Wrong answer0/337ms4916 KiB
18Wrong answer0/371ms8500 KiB
19Wrong answer0/3171ms11576 KiB
20Partially correct1/364ms424 KiB
21Wrong answer0/3199ms15612 KiB
22Time limit exceeded0/3216ms15800 KiB