結果

問題 No.488 四角関係
ユーザー htkbhtkb
提出日時 2018-05-22 21:13:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 309 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 10,572 KB
実行使用メモリ 8,360 KB
最終ジャッジ日時 2023-09-11 01:20:54
合計ジャッジ時間 3,318 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
8,240 KB
testcase_01 AC 101 ms
8,344 KB
testcase_02 AC 120 ms
8,308 KB
testcase_03 AC 51 ms
8,144 KB
testcase_04 AC 75 ms
8,096 KB
testcase_05 AC 158 ms
8,120 KB
testcase_06 AC 231 ms
8,164 KB
testcase_07 AC 309 ms
8,240 KB
testcase_08 AC 237 ms
8,360 KB
testcase_09 AC 16 ms
8,256 KB
testcase_10 AC 38 ms
8,216 KB
testcase_11 AC 16 ms
8,280 KB
testcase_12 AC 30 ms
8,140 KB
testcase_13 AC 35 ms
8,164 KB
testcase_14 AC 19 ms
8,212 KB
testcase_15 AC 16 ms
8,132 KB
testcase_16 AC 15 ms
8,204 KB
testcase_17 AC 15 ms
8,120 KB
testcase_18 AC 16 ms
8,132 KB
testcase_19 AC 16 ms
8,212 KB
testcase_20 AC 15 ms
8,292 KB
testcase_21 AC 15 ms
8,136 KB
testcase_22 AC 15 ms
8,144 KB
testcase_23 AC 16 ms
8,156 KB
testcase_24 AC 16 ms
8,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations
N, M = map(int, input().split())
edges = [set() for _ in [0]*N]
for x, y in (map(int, input().split()) for _ in [0]*M):
    edges[x].add(y)
    edges[y].add(x)
result = 0
for l in combinations(range(N), 4):
    for i, n in enumerate(l):
        if len(edges[n].intersection(l[:i]+l[i+1:])) != 2:
            break
    else:
        result += 1
print(result)
0