結果

問題 No.9 モンスターのレベル上げ
ユーザー LaLa
提出日時 2021-01-06 14:23:15
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 4,162 ms / 5,000 ms
コード長 317 bytes
コンパイル時間 30 ms
使用メモリ 15,536 KB
最終ジャッジ日時 2022-12-13 03:09:30
合計ジャッジ時間 41,443 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 73 ms
13,844 KB
testcase_01 AC 71 ms
13,808 KB
testcase_02 AC 4,162 ms
15,384 KB
testcase_03 AC 3,179 ms
15,220 KB
testcase_04 AC 1,653 ms
14,832 KB
testcase_05 AC 1,079 ms
14,740 KB
testcase_06 AC 403 ms
14,332 KB
testcase_07 AC 79 ms
13,904 KB
testcase_08 AC 511 ms
14,424 KB
testcase_09 AC 3,965 ms
15,420 KB
testcase_10 AC 73 ms
13,868 KB
testcase_11 AC 3,907 ms
15,384 KB
testcase_12 AC 4,162 ms
15,404 KB
testcase_13 AC 4,131 ms
15,536 KB
testcase_14 AC 4,097 ms
15,384 KB
testcase_15 AC 3,669 ms
15,156 KB
testcase_16 AC 130 ms
14,368 KB
testcase_17 AC 2,289 ms
15,008 KB
testcase_18 AC 1,892 ms
14,880 KB
testcase_19 AC 109 ms
13,844 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

mod=2000
ans=1500
n=gets.to_i
a=gets.split.map{|i|i.to_i*mod}.sort+[10**9]
b=gets.split.map{|i|i.to_i/2}

for i in 1..n do
  pq=a.dup
  cnt=0
  
  b.rotate(i).each{|e|
    l=pq.shift
    up=l+e*mod+1
    pq.insert((0..n-1).bsearch{|x|pq[x]>=up},up)
  }
  
  cnt=pq.map{|x|x%mod}.max
  ans=cnt if ans>cnt
end

puts ans
0