結果

問題 No.1137 Circles
ユーザー simansiman
提出日時 2022-03-08 00:54:48
言語 Ruby
(3.3.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 243 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 19,288 KB
最終ジャッジ日時 2023-09-30 04:16:15
合計ジャッジ時間 6,822 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
19,116 KB
testcase_01 AC 225 ms
19,068 KB
testcase_02 AC 123 ms
19,204 KB
testcase_03 AC 176 ms
19,148 KB
testcase_04 AC 195 ms
19,288 KB
testcase_05 AC 134 ms
19,148 KB
testcase_06 AC 220 ms
19,264 KB
testcase_07 AC 168 ms
19,264 KB
testcase_08 AC 216 ms
19,104 KB
testcase_09 AC 146 ms
19,116 KB
testcase_10 AC 166 ms
19,272 KB
testcase_11 AC 176 ms
19,092 KB
testcase_12 AC 239 ms
19,064 KB
testcase_13 AC 150 ms
19,284 KB
testcase_14 AC 229 ms
19,056 KB
testcase_15 AC 156 ms
19,160 KB
testcase_16 AC 175 ms
19,180 KB
testcase_17 AC 131 ms
19,112 KB
testcase_18 AC 214 ms
19,248 KB
testcase_19 AC 151 ms
19,172 KB
testcase_20 AC 144 ms
19,156 KB
testcase_21 AC 118 ms
19,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
arr = Array.new(500_010, 0)

N.times do
  x, r = gets.split.map(&:to_i)
  x += 250_000

  arr[x - r] += 1
  arr[x + r] -= 1
end

ans = 0

1.upto(500_000) do |i|
  arr[i] += arr[i - 1]
  ans = arr[i] if ans < arr[i]
end

puts ans
0