結果
問題 |
No.488 四角関係
|
ユーザー |
|
提出日時 | 2018-08-30 21:56:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,014 ms / 5,000 ms |
コード長 | 508 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-09-13 20:35:48 |
合計ジャッジ時間 | 5,643 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
from itertools import permutations 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 permutations(range(n), 4): if (node[a][b] == node[b][c] == node[c][d] == node[d][a] == 1) and (node[a][c] == node[b][d] == 0): ans.add(frozenset([a, b, c, d])) return len(ans) print(solve())