233572026-01-20 16:33:51linhnkTelefonközpont (40 pont)cpp17Accepted 40/4094ms2464 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, d=0, dmax=0; cin>>n; vector<int> be(n), ki(n);
	for(int i=0; i<n; i++){
		cin>>be[i]>>ki[i];
	}
	sort(be.begin(), be.end());
	sort(ki.begin(), ki.end());
	int a=0, b=0;
	while(a<n&&b<n){
		if(ki[b]<be[a]){
			b++;
			d--;
			//cerr<<h++<<" - "<<a<<' '<<b<<' '<<d<<endl;
		}
		else{
			a++;
			d++;
			dmax=max(dmax, d);
			//cerr<<h++<<" + "<<a<<' '<<b<<' '<<d<<endl;
		}
	}
	cout<<dmax;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/01ms316 KiB
2Accepted0/093ms2460 KiB
3Accepted2/21ms500 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/216ms672 KiB
7Accepted2/246ms1300 KiB
8Accepted3/346ms1432 KiB
9Accepted3/354ms1736 KiB
10Accepted3/383ms2292 KiB
11Accepted3/393ms2428 KiB
12Accepted3/339ms1492 KiB
13Accepted3/393ms2460 KiB
14Accepted3/341ms1332 KiB
15Accepted3/345ms1592 KiB
16Accepted3/382ms2204 KiB
17Accepted3/394ms2464 KiB