結果

問題 No.488 四角関係
ユーザー brthyyjp
提出日時 2020-08-28 09:47:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 826 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 76,544 KB
最終ジャッジ日時 2024-11-09 01:07:37
合計ジャッジ時間 5,137 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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