結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
yn
|
| 提出日時 | 2017-02-26 15:22:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 557 ms / 5,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 82,584 KB |
| 実行使用メモリ | 106,236 KB |
| 最終ジャッジ日時 | 2024-06-11 16:40:08 |
| 合計ジャッジ時間 | 5,558 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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:
cnt = 0
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)
yn