結果

問題 No.488 四角関係
コンテスト
ユーザー brthyyjp
提出日時 2020-08-28 09:47:04
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 504 ms / 5,000 ms
コード長 479 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 205 ms
コンパイル使用メモリ 85,632 KB
実行使用メモリ 81,280 KB
最終ジャッジ日時 2026-05-09 05:58:40
合計ジャッジ時間 3,965 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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