結果
| 問題 |
No.2353 Guardian Dogs in Spring
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-18 12:42:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 648 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 82,120 KB |
| 実行使用メモリ | 856,424 KB |
| 最終ジャッジ日時 | 2024-06-26 01:41:50 |
| 合計ジャッジ時間 | 5,417 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 MLE * 1 -- * 36 |
ソースコード
from math import gcd
N = int(input())
X, Y = [0] * N, [0] * N
for i in range(N):
X[i], Y[i] = map(int, input().split())
kumi = []
for i in range(N):
for j in range(i + 1, N):
kumi.append(((X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2, i, j))
kumi.sort()
used = set()
tilt = set()
ans = []
for d, x, y in kumi:
w, h = X[x] - X[y], Y[x] - Y[y]
if w == 0:
katamuki = 10000
else:
katamuki = h / w
if x not in used and y not in used and katamuki not in tilt:
ans.append((x + 1, y + 1))
used.add(x)
used.add(y)
tilt.add(katamuki)
print(len(ans))
for x, y in ans:
print(x, y)