結果

問題 No.488 四角関係
ユーザー brthyyjpbrthyyjp
提出日時 2020-08-28 09:47:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 807 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-26 10:33:19
合計ジャッジ時間 4,781 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
76,672 KB
testcase_01 AC 164 ms
75,808 KB
testcase_02 AC 191 ms
75,716 KB
testcase_03 AC 105 ms
76,024 KB
testcase_04 AC 147 ms
75,708 KB
testcase_05 AC 251 ms
75,904 KB
testcase_06 AC 333 ms
76,288 KB
testcase_07 AC 433 ms
76,204 KB
testcase_08 AC 807 ms
76,672 KB
testcase_09 AC 37 ms
52,224 KB
testcase_10 AC 90 ms
76,432 KB
testcase_11 AC 53 ms
65,408 KB
testcase_12 AC 75 ms
75,760 KB
testcase_13 AC 88 ms
75,736 KB
testcase_14 AC 59 ms
69,632 KB
testcase_15 AC 48 ms
62,592 KB
testcase_16 AC 37 ms
52,480 KB
testcase_17 AC 36 ms
52,224 KB
testcase_18 AC 46 ms
60,288 KB
testcase_19 AC 50 ms
62,592 KB
testcase_20 AC 38 ms
52,736 KB
testcase_21 AC 37 ms
52,224 KB
testcase_22 AC 39 ms
52,608 KB
testcase_23 AC 39 ms
52,864 KB
testcase_24 AC 46 ms
61,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
g = [set() for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    g[a].add(b)
    g[b].add(a)

if n < 4:
    print(0)
    exit()

import itertools
ans = 0
for p in itertools.permutations(range(n), 4):
    for j in range(4):
            if p[(j+1)%4] not in g[p[j]]:
                break
    else:
        if p[2] not in g[p[0]] and  p[3] not in g[p[1]]:
            #print(p)
            ans += 1
ans //= 2**3
print(ans)
0