結果

問題 No.488 四角関係
ユーザー Konton7
提出日時 2019-05-07 23:06:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 935 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 427,776 KB
最終ジャッジ日時 2024-07-02 00:23:44
合計ジャッジ時間 7,073 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 1 TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

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