Submission #1466463


Source Code Expand

#include <stdio.h>

int main(){
	long int N, M;
	scanf("%ld %ld",&N, &M);

	long int a[N], b[N];
	int flag[2][N];
	int k = 0;
	for(int i = 0; i < N; i++){
		flag[0][i] = 0;
		flag[1][i] = 0;
	}
	for(int i = 0; i < M; i++){
		long long int buf1, buf2;
		scanf("%ld %ld", &buf1, &buf2);
		if(buf1 == 1){
			a[k] = buf1;
			b[k] = buf2;
			flag[0][b[k]-1] = 1;
			k++;
		} else if(buf2 == N) {
			a[k] = buf1;
			b[k] = buf2;
			flag[1][a[k]-1] = 1;
			k++;
		}
	}

	for(int i = 0; i < M; i++){
		if(flag[0][i] == 1 && flag[1][i] == 1){
			printf("POSSIBLE\n");
			return 0;
		}
	}

	printf("IMPOSSIBLE\n");

	return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User ponntuu3
Language C (GCC 5.4.1)
Score 300
Code Size 657 Byte
Status AC
Exec Time 38 ms
Memory 4864 KiB

Compile Error

./Main.c: In function ‘main’:
./Main.c:16:9: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
   scanf("%ld %ld", &buf1, &buf2);
         ^
./Main.c:16:9: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 3 has type ‘long long int *’ [-Wformat=]
./Main.c:5:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%ld %ld",&N, &M);
  ^
./Main.c:16:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%ld %ld", &buf1, &buf2);
   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 11
Set Name Test Cases
Sample example0, example1, example2, example3
All example0, example1, example2, example3, last0, last1, many0, many1, rand0, rand1, rand2
Case Name Status Exec Time Memory
example0 AC 0 ms 128 KiB
example1 AC 0 ms 128 KiB
example2 AC 1 ms 896 KiB
example3 AC 0 ms 128 KiB
last0 AC 36 ms 4352 KiB
last1 AC 35 ms 2816 KiB
many0 AC 38 ms 4864 KiB
many1 AC 38 ms 4864 KiB
rand0 AC 24 ms 3072 KiB
rand1 AC 35 ms 3712 KiB
rand2 AC 21 ms 2688 KiB