結果
問題 |
No.2353 Guardian Dogs in Spring
|
ユーザー |
|
提出日時 | 2023-06-16 23:20:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 620 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 82,328 KB |
実行使用メモリ | 79,104 KB |
最終ジャッジ日時 | 2024-06-24 16:32:11 |
合計ジャッジ時間 | 29,423 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 WA * 5 |
ソースコード
n = int(input()) P = [list(map(int, input().split())) + [i + 1] for i in range(n)] P.sort(key=lambda x: (x[0], x[1])) ANS = [] seen = set() for i in range(n): cx, cy, idx = P[i] if idx in seen: continue d = 10**18 res = None for j in range(n): nx, ny, nidx = P[j] if idx == nidx or nidx in seen: continue if (nx - cx)**2 + (ny - cy)**2 < d: d = (nx - cx)**2 + (ny - cy)**2 res = nidx if res is not None: ANS.append((idx, res)) seen.add(idx) seen.add(res) print(len(ANS)) for ans in ANS: print(*ans)