結果

問題 No.488 四角関係
ユーザー nebukuro09nebukuro09
提出日時 2017-02-24 23:57:49
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 1,504 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 77,304 KB
実行使用メモリ 80,396 KB
最終ジャッジ日時 2023-08-31 00:18:54
合計ジャッジ時間 9,942 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 332 ms
79,640 KB
testcase_01 AC 324 ms
79,752 KB
testcase_02 AC 343 ms
79,900 KB
testcase_03 AC 203 ms
79,644 KB
testcase_04 AC 248 ms
79,508 KB
testcase_05 AC 432 ms
79,536 KB
testcase_06 AC 513 ms
79,812 KB
testcase_07 AC 828 ms
79,632 KB
testcase_08 AC 1,504 ms
80,396 KB
testcase_09 AC 70 ms
76,528 KB
testcase_10 AC 169 ms
79,552 KB
testcase_11 AC 113 ms
79,792 KB
testcase_12 AC 134 ms
79,284 KB
testcase_13 AC 162 ms
79,340 KB
testcase_14 AC 120 ms
80,004 KB
testcase_15 AC 93 ms
79,544 KB
testcase_16 AC 72 ms
76,268 KB
testcase_17 AC 72 ms
76,204 KB
testcase_18 AC 86 ms
79,360 KB
testcase_19 AC 94 ms
79,452 KB
testcase_20 AC 72 ms
76,688 KB
testcase_21 AC 71 ms
76,256 KB
testcase_22 AC 75 ms
76,680 KB
testcase_23 AC 73 ms
76,228 KB
testcase_24 AC 89 ms
79,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations, permutations

n, m = map(int, raw_input().split())
adj = [set() for _ in xrange(n)]
for i in xrange(m):
    a, b = map(int, raw_input().split())
    adj[a].add(b)
    adj[b].add(a)


ans = 0
for c in combinations(range(n), 4):
    for p in permutations(c):
        if all(p[i] in adj[p[(i+1)%4]] for i in xrange(4)) and p[0] not in adj[p[2]] and p[1] not in adj[p[3]]:
            ans += 1
            break
print ans
0