Submission #524563


Source Code Expand

Copy
N = int(raw_input())
coordinates = []
pairs = []
for i in range(2*N+1):
	str = raw_input()
	str_list = str.split(" ")
	coordinates.append(map(int, str_list))
	pairs.append([])

# pair candidate
index = 0
for coordiante in coordinates:
	for candidate in coordinates:
		if coordiante[0] == candidate[0] and coordiante[1] == candidate[1]:
			continue
		if coordiante[0] == candidate[0] or coordiante[1] == candidate[1]:
			#print index
			pairs[index].append(candidate)
	index += 1

#print (pairs)
flg = True
for coordiante in coordinates:
	for pair in pairs:
		#print (pair)
		#print (coordiante)
		if len(pair) < 2 and coordiante in pair:
			print "NG"
			flg = False
			break
	if flg:
		print "OK"
	flg = True

Submission Info

Submission Time
Task D - みんな仲良し高橋君
User tasuwo_
Language Python (2.7.3)
Score 0
Code Size 741 Byte
Status
Exec Time 3043 ms
Memory 61580 KB

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 3041 ms 61580 KB
bone_1.txt 3042 ms 61576 KB
bone_2.txt 3042 ms 61572 KB
bone_bubun_0.txt 3039 ms 47084 KB
bone_bubun_1.txt 3040 ms 41636 KB
bone_bubun_2.txt 3037 ms 44972 KB
example_0.txt 58 ms 3384 KB
example_1.txt 57 ms 3392 KB
example_2.txt 58 ms 3384 KB
handmade_0.txt 58 ms 3380 KB
handmade_1.txt 56 ms 3384 KB
handmade_2.txt 54 ms 3388 KB
handmade_3.txt 55 ms 3384 KB
komakai_0.txt 3040 ms 57656 KB
komakai_1.txt 3041 ms 57656 KB
komakai_2.txt 3039 ms 57532 KB
komakai_bubun_0.txt 3040 ms 57640 KB
komakai_bubun_1.txt 3042 ms 57524 KB
komakai_bubun_2.txt 3039 ms 57552 KB
maxrand_0.txt 3043 ms 57656 KB
maxrand_1.txt 3041 ms 57652 KB
maxrand_bubun_0.txt 3041 ms 57648 KB
maxrand_bubun_1.txt 3041 ms 57656 KB
random_0.txt 3033 ms 5164 KB
random_1.txt 3038 ms 34988 KB
random_bubun_0.txt 3035 ms 5412 KB
random_bubun_1.txt 3037 ms 18860 KB
renket_0.txt 3042 ms 57524 KB
renket_1.txt 3041 ms 57660 KB
smallrand_0.txt 82 ms 3384 KB
smallrand_1.txt 79 ms 3372 KB
smallrand_bubun_0.txt 57 ms 3308 KB
smallrand_bubun_1.txt 56 ms 3368 KB
smallrand_bubun_2.txt 58 ms 3380 KB
square_0.txt 3042 ms 55228 KB
square_1.txt 3039 ms 55724 KB
square_bubun_0.txt 3041 ms 56248 KB
square_bubun_1.txt 3040 ms 41892 KB
supersmall_0.txt 58 ms 3380 KB
supersmall_1.txt 59 ms 3376 KB
threeren_0.txt 3042 ms 57648 KB
threeren_1.txt 3042 ms 57592 KB
treebase_0.txt 3040 ms 47544 KB
treebase_1.txt 3035 ms 13620 KB
treebase_2.txt 3042 ms 36656 KB