Submission #32430698


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<pair<int,int>>query;
	for(int i=0;i<n;i++){
		int l,r;
		cin >> l >> r;
		query.push_back({l,0});
		query.push_back({r,1});
	}
	sort(query.begin(),query.end());
	
	int cnt=0;
	for(auto[t,f]:query){
		if(f==0){
			if(cnt==0)cout << t << ' ';
			cnt++;
		}else{
			cnt--;
			if(cnt==0)cout << t << endl;
		}
	}
}

Submission Info

Submission Time
Task D - Union of Interval
User kyopro_friends
Language C++ (GCC 9.2.1)
Score 400
Code Size 420 Byte
Status AC
Exec Time 129 ms
Memory 7396 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 24
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 122 ms 7360 KiB
random_02.txt AC 39 ms 4148 KiB
random_03.txt AC 122 ms 7272 KiB
random_04.txt AC 110 ms 7292 KiB
random_05.txt AC 122 ms 7336 KiB
random_06.txt AC 119 ms 7396 KiB
random_07.txt AC 119 ms 7340 KiB
random_08.txt AC 58 ms 5192 KiB
random_09.txt AC 119 ms 7344 KiB
random_10.txt AC 104 ms 7396 KiB
random_11.txt AC 97 ms 7340 KiB
random_12.txt AC 3 ms 3552 KiB
random_13.txt AC 106 ms 5236 KiB
random_14.txt AC 86 ms 5216 KiB
random_15.txt AC 76 ms 4128 KiB
random_16.txt AC 119 ms 7396 KiB
random_17.txt AC 118 ms 7336 KiB
random_18.txt AC 66 ms 5316 KiB
random_19.txt AC 118 ms 7276 KiB
random_20.txt AC 64 ms 5104 KiB
random_21.txt AC 129 ms 4124 KiB
random_22.txt AC 92 ms 4188 KiB
sample_01.txt AC 6 ms 3444 KiB
sample_02.txt AC 2 ms 3364 KiB