結果
問題 | No.488 四角関係 |
ユーザー |
![]() |
提出日時 | 2019-12-07 18:44:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 382 ms / 5,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 82,332 KB |
実行使用メモリ | 76,672 KB |
最終ジャッジ日時 | 2024-12-26 02:49:22 |
合計ジャッジ時間 | 4,583 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
from itertools import *N, M = map(int, input().split())adj_mat = [[0]*N for _ in range(N)]for _ in range(M):ai, bi = map(int, input().split())adj_mat[ai-1][bi-1] = 1adj_mat[bi-1][ai-1] = 1ans = 0for c in combinations(range(N), 4):for p in permutations(c):a, b, c, d = p[0], p[1], p[2], p[3]if adj_mat[a][b]==1 and adj_mat[b][c]==1 and adj_mat[c][d]==1 and adj_mat[d][a]==1 and adj_mat[a][c]==0 and adj_mat[b][d]==0:ans += 1breakprint(ans)