Submission #524291


Source Code Expand

Copy
#include <stdio.h>

int main() {
	long int i, j, N;
	int k=0;

	scanf("%ld", &N);
	long int S[2*N+1], T[2*N+1], X[2*N+1], Y[2*N+1];
	for (i=0;i<2*N+1;i++) {
		scanf("%ld%ld", &X[i], &Y[i]);
		S[i] = 0; T[i] = 0;
	}

	for (i=0;i<2*N+1;i++) {
		S[X[i]-1]++;
		T[Y[i]-1]++;
	}
	for (i=0;i<2*N+1;i++) {
		S[X[i]-1]--;
		T[Y[i]-1]--;
		for (j=0;j<2*N+1;j++) {
			if (j==i) continue;
			if (S[X[j]-1] == 1 && T[Y[j]-1] == 1) {
				k++;
				break;
			}
		}
		if (k) {printf("NG\n"); k--;}
		else {printf("OK\n");}
		S[X[i]-1]++;
		T[Y[i]-1]++;
	}

	return 0;
}

Submission Info

Submission Time
Task D - みんな仲良し高橋君
User k_ashiya
Language C (GCC 4.9.2)
Score 0
Code Size 589 Byte
Status
Exec Time 3037 ms
Memory 7080 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:7:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%ld", &N);
  ^
./Main.c:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%ld%ld", &X[i], &Y[i]);
   ^

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_0.txt, example_1.txt, example_2.txt
Subtask1 0 / 30 bone_bubun_0.txt, bone_bubun_1.txt, bone_bubun_2.txt, komakai_bubun_0.txt, komakai_bubun_1.txt, komakai_bubun_2.txt, maxrand_bubun_0.txt, maxrand_bubun_1.txt, random_bubun_0.txt, random_bubun_1.txt, smallrand_bubun_0.txt, smallrand_bubun_1.txt, smallrand_bubun_2.txt, square_bubun_0.txt, square_bubun_1.txt
All 0 / 70 bone_0.txt, bone_1.txt, bone_2.txt, bone_bubun_0.txt, bone_bubun_1.txt, bone_bubun_2.txt, example_0.txt, example_1.txt, example_2.txt, handmade_0.txt, handmade_1.txt, handmade_2.txt, handmade_3.txt, komakai_0.txt, komakai_1.txt, komakai_2.txt, komakai_bubun_0.txt, komakai_bubun_1.txt, komakai_bubun_2.txt, maxrand_0.txt, maxrand_1.txt, maxrand_bubun_0.txt, maxrand_bubun_1.txt, random_0.txt, random_1.txt, random_bubun_0.txt, random_bubun_1.txt, renket_0.txt, renket_1.txt, smallrand_0.txt, smallrand_1.txt, smallrand_bubun_0.txt, smallrand_bubun_1.txt, smallrand_bubun_2.txt, square_0.txt, square_1.txt, square_bubun_0.txt, square_bubun_1.txt, supersmall_0.txt, supersmall_1.txt, threeren_0.txt, threeren_1.txt, treebase_0.txt, treebase_1.txt, treebase_2.txt, example_0.txt, example_1.txt, example_2.txt
Case Name Status Exec Time Memory
bone_0.txt 3037 ms 7072 KB
bone_1.txt 3036 ms 7080 KB
bone_2.txt 3036 ms 7068 KB
bone_bubun_0.txt 3035 ms 2528 KB
bone_bubun_1.txt 107 ms 920 KB
bone_bubun_2.txt 3033 ms 3104 KB
example_0.txt 25 ms 792 KB
example_1.txt 25 ms 796 KB
example_2.txt 25 ms 800 KB
handmade_0.txt 24 ms 792 KB
handmade_1.txt 25 ms 700 KB
handmade_2.txt 23 ms 672 KB
handmade_3.txt 23 ms 796 KB
komakai_0.txt 3036 ms 6972 KB
komakai_1.txt 3036 ms 7076 KB
komakai_2.txt 3034 ms 6988 KB
komakai_bubun_0.txt 3034 ms 7072 KB
komakai_bubun_1.txt 3036 ms 7076 KB
komakai_bubun_2.txt 3034 ms 7076 KB
maxrand_0.txt 204 ms 6940 KB
maxrand_1.txt 211 ms 6944 KB
maxrand_bubun_0.txt 3035 ms 6988 KB
maxrand_bubun_1.txt 3036 ms 7080 KB
random_0.txt 30 ms 924 KB
random_1.txt 123 ms 4340 KB
random_bubun_0.txt 215 ms 928 KB
random_bubun_1.txt 3035 ms 2592 KB
renket_0.txt 3036 ms 7072 KB
renket_1.txt 3036 ms 7068 KB
smallrand_0.txt 26 ms 696 KB
smallrand_1.txt 23 ms 800 KB
smallrand_bubun_0.txt 25 ms 800 KB
smallrand_bubun_1.txt 25 ms 792 KB
smallrand_bubun_2.txt 24 ms 796 KB
square_0.txt 3036 ms 6820 KB
square_1.txt 3037 ms 6828 KB
square_bubun_0.txt 3036 ms 6828 KB
square_bubun_1.txt 3035 ms 5276 KB
supersmall_0.txt 25 ms 792 KB
supersmall_1.txt 25 ms 792 KB
threeren_0.txt 3036 ms 7068 KB
threeren_1.txt 3036 ms 7076 KB
treebase_0.txt 3037 ms 5836 KB
treebase_1.txt 3034 ms 1960 KB
treebase_2.txt 3037 ms 4552 KB