結果
| 問題 | No.488 四角関係 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-26 00:50:32 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 135 ms / 5,000 ms |
| コード長 | 806 bytes |
| 記録 | |
| コンパイル時間 | 591 ms |
| コンパイル使用メモリ | 20,828 KB |
| 実行使用メモリ | 15,576 KB |
| 最終ジャッジ日時 | 2026-03-27 17:26:45 |
| 合計ジャッジ時間 | 3,932 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
def read_data():
N, M = map(int, input().split())
Es = [set() for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
Es[a].add(b)
Es[b].add(a)
return N, M, Es
def solve(N, M, Es):
pool = set()
for a in range(N):
for b in Es[a]:
for c in Es[b]:
if c == a:
continue
if a in Es[c]:
continue
for d in Es[c]:
if d == b:
continue
if a not in Es[d]:
continue
if b in Es[d]:
continue
pool.add(tuple(sorted([a, b, c, d])))
return len(pool)
N, M, Es = read_data()
print(solve(N, M, Es))