結果

問題 No.488 四角関係
ユーザー Konton7Konton7
提出日時 2019-05-07 23:06:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 935 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 19,032 KB
最終ジャッジ日時 2023-09-14 17:15:43
合計ジャッジ時間 7,218 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
19,032 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = [ int(v) for v in input().split() ]
link_list = [[] for i in range(n)]
link_list2 = []

for i in range(m):
	x, y = [ int(v) for v in input().split() ]
	link_list[x].append(y)
	link_list[y].append(x)
	link_list2.append([x,y])
def connect(length):
	if length == 1:
		outlist = [ [i] for i in range(n) ]
		return outlist
	else:
		templist = connect(length-1)
		outlist = []

		for i in range(len(templist)):
			k = templist[i][-1]
			templist2 = [ (templist[i] + [link_list[k][j]] ) for j in range(len(link_list[k])) ]
			outlist += templist2

		return outlist

anslist = []
anslist2 = []

for i in connect(5):
	if len(set(i)) == 4 and i[0] == i[4]:
		anslist.append(i)

for i in anslist:
	if [i[0], i[2]] not in link_list2 and [i[1], i[3]] not in link_list2:
		if [i[2], i[0]] not in link_list2 and [i[3], i[1]] not in link_list2:
			if sorted(set(i)) not in anslist2:
				anslist2.append(sorted(set(i)))
				
print(len(anslist2))
0