結果

問題 No.2353 Guardian Dogs in Spring
ユーザー sepa38sepa38
提出日時 2023-06-16 22:01:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 79,248 KB
最終ジャッジ日時 2023-09-06 19:49:44
合計ジャッジ時間 32,174 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,296 KB
testcase_01 AC 63 ms
71,220 KB
testcase_02 AC 68 ms
71,292 KB
testcase_03 AC 65 ms
71,496 KB
testcase_04 AC 66 ms
71,052 KB
testcase_05 AC 1,181 ms
78,952 KB
testcase_06 AC 1,116 ms
78,904 KB
testcase_07 AC 1,224 ms
79,000 KB
testcase_08 AC 1,228 ms
78,804 KB
testcase_09 AC 1,163 ms
79,228 KB
testcase_10 AC 1,180 ms
78,916 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1,188 ms
79,020 KB
testcase_14 WA -
testcase_15 AC 1,168 ms
78,944 KB
testcase_16 AC 1,161 ms
79,248 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1,205 ms
78,836 KB
testcase_20 AC 78 ms
76,132 KB
testcase_21 AC 146 ms
78,088 KB
testcase_22 AC 253 ms
79,016 KB
testcase_23 AC 869 ms
78,944 KB
testcase_24 AC 134 ms
78,124 KB
testcase_25 AC 128 ms
78,076 KB
testcase_26 AC 119 ms
77,568 KB
testcase_27 AC 81 ms
76,216 KB
testcase_28 AC 153 ms
78,112 KB
testcase_29 AC 396 ms
78,808 KB
testcase_30 AC 258 ms
78,800 KB
testcase_31 AC 325 ms
78,684 KB
testcase_32 AC 860 ms
79,228 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 160 ms
78,232 KB
testcase_37 AC 126 ms
77,520 KB
testcase_38 AC 200 ms
78,544 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ls = [list(map(int, input().split())) for _ in range(n)]
md = [0] * n
for i in range(n):
  xi, yi = ls[i]
  d = 1 << 30
  for j in range(n):
    if i == j:
      continue
    xj, yj = ls[j]
    d = min(d, (xi-xj)**2+(yi-yj)**2)
  md[i] = d
order = [i for i in range(n)]
order.sort(key = lambda x: md[x])
ans = []
flg = [0] * n
print(n//2)
for i in order:
  if flg[i]:
    continue
  flg[i] = 1
  cnd = -1
  d = 1 << 30
  xi, yi = ls[i]
  for j in range(n):
    if flg[j]:
      continue
    xj, yj = ls[j]
    if d > (xi - xj) ** 2 + (yi - yj) ** 2:
      d = (xi - xj) ** 2 + (yi - yj) ** 2
      cnd = j
  if cnd != -1:
    print(i + 1, cnd + 1)
    flg[cnd] = 1
0