結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-30 22:43:24 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 662 bytes |
| コンパイル時間 | 103 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-13 20:36:16 |
| 合計ジャッジ時間 | 1,758 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 6 WA * 16 |
ソースコード
from collections import defaultdict
from itertools import combinations
def solve():
n, m = map(int, input().split())
if n < 4:
return 0
node = defaultdict(set)
for _ in range(m):
a, b = map(int, input().split())
node[a].add(b)
node[b].add(a)
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
if j in node[i]:
continue
sn = node[i] & node[j] - {i, j}
if len(sn) < 2:
continue
for a, b in combinations(tuple(sn), 2):
if a not in node[b]:
ans += 1
return ans
print(solve())