結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-30 22:10:08 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 431 ms / 5,000 ms |
| コード長 | 542 bytes |
| コンパイル時間 | 407 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 12,800 KB |
| 最終ジャッジ日時 | 2024-09-13 20:35:52 |
| 合計ジャッジ時間 | 3,821 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
from itertools import permutations
from itertools import combinations
def solve():
n, m = map(int, input().split())
if n < 4:
return 0
node = [[0] * n for _ in range(n)]
for _ in range(m):
a, b = map(int, input().split())
node[a][b] = node[b][a] = 1
ans = set()
for a, b, c, d in combinations(range(n), 4):
if all(node[w][x] + node[w][y] + node[w][z] == 2 for w, x, y, z in permutations((a, b, c, d), 4)):
ans.add(frozenset([a, b, c, d]))
return len(ans)
print(solve())