結果
問題 |
No.488 四角関係
|
ユーザー |
![]() |
提出日時 | 2017-02-26 15:28:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 599 ms / 5,000 ms |
コード長 | 607 bytes |
コンパイル時間 | 324 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 106,496 KB |
最終ジャッジ日時 | 2024-06-11 16:41:41 |
合計ジャッジ時間 | 5,592 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
import itertools n, m = map(int, input().split()) graph = [[0] * n for i in range(n)] for i in range(m): a, b = map(int, input().split()) graph[a][b] = 1 graph[b][a] = 1 c = list(itertools.combinations(range(n), 4)) ans = 0 for i,j,k,l in c: x = list(itertools.permutations([i,j,k,l])) for loop in range(len(x)): x1 = x[loop][0] x2 = x[loop][1] x3 = x[loop][2] x4 = x[loop][3] if graph[x1][x2] == graph[x2][x3] == graph[x3][x4] == graph[x4][x1] == 1 and graph[x1][x3] == graph[x2][x4] == 0: ans += 1 break print(ans)