Submission #1331377


Source Code Expand

#include <stdio.h>

int main()
{
	int X,N;
	scanf ("%d %d",&X,&N);
	
	int s[101],e[101];
	for (int i=0;i<N;i++) scanf ("%d %d",&s[i],&e[i]);

	int l = 0, ans = 0;
	while (l < X){
		int mx = 0;
		for (int i=0;i<N;i++) if (s[i] <= l + 1){
			if (mx < e[i]) mx = e[i];
		}

		if (l < mx){
			l = mx;
			ans++;
		}
		else{
			ans--;
			break;
		}
	}

	if (ans == -1) puts("Impossible");
	else printf ("%d\n",ans);

	return 0;
}

Submission Info

Submission Time
Task D - 権力
User august14
Language C++14 (GCC 5.4.1)
Score 0
Code Size 454 Byte
Status WA
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:6:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d %d",&X,&N);
                       ^
./Main.cpp:9:51: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0;i<N;i++) scanf ("%d %d",&s[i],&e[i]);
                                                   ^

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 40
WA × 13
Set Name Test Cases
All 00_sample_1, 00_sample_2, 00_teuchi_1, 00_teuchi_2, 00_teuchi_3, 00_teuchi_4, 10_max1_06, 10_max1_07, 10_max1_08, 10_max1_09, 10_max1_10, 10_max1_11, 10_max1_12, 10_max2_13, 10_max2_14, 10_max2_15, 10_max2_16, 10_max2_17, 10_max2_18, 10_max2_19, 10_max2_20, 10_max2_21, 10_max2_22, 10_min_00, 10_min_01, 10_min_02, 10_min_03, 10_min_04, 10_min_05, 10_rand_27, 10_rand_28, 10_rand_29, 10_rand_30, 10_rand_31, 10_rand_32, 10_rand_33, 10_rand_34, 10_rand_35, 10_rand_36, 10_rand_37, 10_rand_38, 10_rand_39, 10_rand_40, 10_rand_41, 10_rand_42, 10_rand_43, 10_rand_44, 10_rand_45, 10_rand_46, 10_unif_23, 10_unif_24, 10_unif_25, 10_unif_26
Case Name Status Exec Time Memory
00_sample_1 AC 1 ms 128 KB
00_sample_2 WA 1 ms 128 KB
00_teuchi_1 AC 1 ms 128 KB
00_teuchi_2 WA 1 ms 128 KB
00_teuchi_3 WA 1 ms 128 KB
00_teuchi_4 AC 1 ms 128 KB
10_max1_06 WA 1 ms 128 KB
10_max1_07 AC 1 ms 128 KB
10_max1_08 AC 1 ms 128 KB
10_max1_09 AC 1 ms 128 KB
10_max1_10 WA 1 ms 128 KB
10_max1_11 AC 1 ms 128 KB
10_max1_12 WA 1 ms 128 KB
10_max2_13 AC 1 ms 128 KB
10_max2_14 WA 1 ms 128 KB
10_max2_15 WA 1 ms 128 KB
10_max2_16 AC 1 ms 128 KB
10_max2_17 AC 1 ms 128 KB
10_max2_18 AC 1 ms 128 KB
10_max2_19 AC 1 ms 128 KB
10_max2_20 WA 1 ms 128 KB
10_max2_21 WA 1 ms 128 KB
10_max2_22 AC 1 ms 128 KB
10_min_00 AC 1 ms 128 KB
10_min_01 AC 1 ms 128 KB
10_min_02 WA 1 ms 128 KB
10_min_03 AC 1 ms 128 KB
10_min_04 AC 1 ms 128 KB
10_min_05 AC 1 ms 128 KB
10_rand_27 AC 1 ms 128 KB
10_rand_28 AC 1 ms 128 KB
10_rand_29 AC 1 ms 128 KB
10_rand_30 AC 1 ms 128 KB
10_rand_31 AC 1 ms 128 KB
10_rand_32 AC 1 ms 128 KB
10_rand_33 AC 1 ms 128 KB
10_rand_34 AC 1 ms 128 KB
10_rand_35 AC 1 ms 128 KB
10_rand_36 AC 1 ms 128 KB
10_rand_37 AC 1 ms 128 KB
10_rand_38 AC 1 ms 128 KB
10_rand_39 AC 1 ms 128 KB
10_rand_40 AC 1 ms 128 KB
10_rand_41 AC 1 ms 128 KB
10_rand_42 AC 1 ms 128 KB
10_rand_43 AC 1 ms 128 KB
10_rand_44 AC 1 ms 128 KB
10_rand_45 AC 1 ms 128 KB
10_rand_46 AC 1 ms 128 KB
10_unif_23 AC 1 ms 128 KB
10_unif_24 WA 1 ms 128 KB
10_unif_25 AC 1 ms 128 KB
10_unif_26 WA 1 ms 128 KB