結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2019-12-05 19:18:07
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 508 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 11,580 KB
実行使用メモリ 19,892 KB
最終ジャッジ日時 2023-08-23 12:18:08
合計ジャッジ時間 11,267 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
19,892 KB
testcase_01 AC 784 ms
15,444 KB
testcase_02 AC 124 ms
15,172 KB
testcase_03 AC 855 ms
15,476 KB
testcase_04 AC 960 ms
15,292 KB
testcase_05 AC 169 ms
15,272 KB
testcase_06 AC 1,531 ms
15,404 KB
testcase_07 AC 1,412 ms
15,536 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def max(a,b); a > b ? a : b; end

N = gets.to_i
S = gets.chomp
A = gets.split.map(&:to_i)
Q = gets.to_i
K = gets.split.map(&:to_i)
E = Array.new(N + 1, 0).tap do |it|
  N.times do |i|
    it[i + 1] = it[i] + (S[i] == 'E' ? 1 : 0)
  end
end
H = Array.new(N + 1, 0).tap do |it|
  N.times do |i|
    it[i + 1] = it[i] + A[i]
  end
end

ANS = K.map do |k|
  e = 0
  (1 .. N).inject(0) do |l,r|
    (l .. r).find{|l_| H[r] - H[l_] <= k }.tap do |l_|
      e = max(e, E[r] - E[l_])
    end
  end
  e
end
puts ANS

0