結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-24 23:57:49 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,797 ms / 5,000 ms |
| コード長 | 454 bytes |
| コンパイル時間 | 2,074 ms |
| コンパイル使用メモリ | 77,184 KB |
| 実行使用メモリ | 79,616 KB |
| 最終ジャッジ日時 | 2025-01-03 00:56:33 |
| 合計ジャッジ時間 | 11,259 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
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