Submission #32430706


Source Code Expand

#include<stdio.h>

int a[200010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int l,r;
		scanf("%d%d",&l,&r);
		a[l]++;
		a[r]--;
	}
	for(int i=1;i<=200005;i++)a[i]+=a[i-1];
	for(int i=1;i<=200005;i++){
		if(a[i-1]==0&&a[i]!=0)printf("%d ",i);
		if(a[i-1]!=0&&a[i]==0)printf("%d\n",i);
	}
}

Submission Info

Submission Time
Task D - Union of Interval
User kyopro_friends
Language C (GCC 9.2.1)
Score 400
Code Size 325 Byte
Status AC
Exec Time 46 ms
Memory 2516 KiB

Compile Error

./Main.c: In function ‘main’:
./Main.c:6:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    6 |  scanf("%d",&n);
      |  ^~~~~~~~~~~~~~
./Main.c:9:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    9 |   scanf("%d%d",&l,&r);
      |   ^~~~~~~~~~~~~~~~~~~

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 45 ms 2460 KiB
random_02.txt AC 16 ms 2456 KiB
random_03.txt AC 42 ms 2460 KiB
random_04.txt AC 40 ms 2456 KiB
random_05.txt AC 45 ms 2448 KiB
random_06.txt AC 42 ms 2440 KiB
random_07.txt AC 41 ms 2508 KiB
random_08.txt AC 20 ms 2432 KiB
random_09.txt AC 46 ms 2416 KiB
random_10.txt AC 38 ms 2440 KiB
random_11.txt AC 37 ms 2452 KiB
random_12.txt AC 2 ms 2432 KiB
random_13.txt AC 37 ms 2416 KiB
random_14.txt AC 27 ms 2460 KiB
random_15.txt AC 22 ms 2412 KiB
random_16.txt AC 42 ms 2516 KiB
random_17.txt AC 42 ms 2440 KiB
random_18.txt AC 22 ms 2404 KiB
random_19.txt AC 44 ms 2416 KiB
random_20.txt AC 23 ms 2508 KiB
random_21.txt AC 31 ms 2460 KiB
random_22.txt AC 20 ms 2412 KiB
sample_01.txt AC 5 ms 2504 KiB
sample_02.txt AC 2 ms 2512 KiB