結果
| 問題 |
No.488 四角関係
|
| ユーザー |
rlangevin
|
| 提出日時 | 2023-01-04 22:18:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 298 ms / 5,000 ms |
| コード長 | 913 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 76,288 KB |
| 最終ジャッジ日時 | 2024-11-28 02:28:20 |
| 合計ジャッジ時間 | 4,298 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
from itertools import *
N, M = map(int, input().split())
S = set()
for i in range(M):
a, b = map(int, input().split())
S.add( (a, b) )
ans = 0
for a, b, c, d in combinations(range(N), 4):
cnt = 0
for tup in combinations([a, b, c, d], 2):
if tup in S:
cnt += 1
if cnt != 4:
continue
cnt = 0
for tup in combinations([a, b, c], 2):
if tup in S:
cnt += 1
if cnt != 2:
continue
cnt = 0
for tup in combinations([a, b, d], 2):
if tup in S:
cnt += 1
if cnt != 2:
continue
cnt = 0
for tup in combinations([a, c, d], 2):
if tup in S:
cnt += 1
if cnt != 2:
continue
cnt = 0
for tup in combinations([b, c, d], 2):
if tup in S:
cnt += 1
if cnt != 2:
continue
ans += 1
print(ans)
rlangevin