結果

問題 No.9 モンスターのレベル上げ
ユーザー LaLa
提出日時 2021-01-06 14:23:15
言語 Ruby
(3.3.0)
結果
AC  
実行時間 4,134 ms / 5,000 ms
コード長 317 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-24 15:27:36
合計ジャッジ時間 40,167 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
12,288 KB
testcase_01 AC 91 ms
12,288 KB
testcase_02 AC 4,134 ms
12,416 KB
testcase_03 AC 3,090 ms
12,416 KB
testcase_04 AC 1,581 ms
12,416 KB
testcase_05 AC 1,039 ms
12,544 KB
testcase_06 AC 395 ms
12,416 KB
testcase_07 AC 84 ms
12,672 KB
testcase_08 AC 502 ms
12,416 KB
testcase_09 AC 3,900 ms
12,544 KB
testcase_10 AC 77 ms
12,032 KB
testcase_11 AC 3,823 ms
12,672 KB
testcase_12 AC 4,042 ms
12,416 KB
testcase_13 AC 3,959 ms
12,416 KB
testcase_14 AC 3,856 ms
12,416 KB
testcase_15 AC 3,562 ms
12,544 KB
testcase_16 AC 130 ms
12,288 KB
testcase_17 AC 2,229 ms
12,416 KB
testcase_18 AC 1,825 ms
12,544 KB
testcase_19 AC 111 ms
12,416 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