結果

問題 No.2353 Guardian Dogs in Spring
ユーザー lloyzlloyz
提出日時 2023-06-16 23:20:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 79,660 KB
最終ジャッジ日時 2023-09-06 22:21:01
合計ジャッジ時間 29,297 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,184 KB
testcase_01 AC 69 ms
71,036 KB
testcase_02 AC 68 ms
71,172 KB
testcase_03 AC 68 ms
71,080 KB
testcase_04 AC 68 ms
71,184 KB
testcase_05 AC 897 ms
79,288 KB
testcase_06 AC 926 ms
79,416 KB
testcase_07 AC 939 ms
79,200 KB
testcase_08 AC 948 ms
79,148 KB
testcase_09 AC 838 ms
78,976 KB
testcase_10 AC 995 ms
79,008 KB
testcase_11 AC 1,039 ms
79,396 KB
testcase_12 AC 852 ms
79,192 KB
testcase_13 AC 1,326 ms
79,376 KB
testcase_14 AC 80 ms
75,888 KB
testcase_15 AC 940 ms
78,668 KB
testcase_16 AC 929 ms
78,700 KB
testcase_17 AC 928 ms
78,672 KB
testcase_18 AC 946 ms
79,312 KB
testcase_19 WA -
testcase_20 AC 82 ms
75,904 KB
testcase_21 AC 141 ms
77,736 KB
testcase_22 AC 282 ms
79,336 KB
testcase_23 AC 823 ms
78,612 KB
testcase_24 AC 138 ms
77,540 KB
testcase_25 AC 126 ms
77,272 KB
testcase_26 AC 110 ms
76,584 KB
testcase_27 AC 83 ms
76,228 KB
testcase_28 AC 153 ms
77,700 KB
testcase_29 AC 486 ms
78,828 KB
testcase_30 AC 299 ms
78,832 KB
testcase_31 AC 402 ms
78,956 KB
testcase_32 AC 789 ms
78,816 KB
testcase_33 AC 1,299 ms
79,660 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 154 ms
77,824 KB
testcase_37 AC 119 ms
77,264 KB
testcase_38 AC 197 ms
78,868 KB
testcase_39 AC 219 ms
78,912 KB
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0