結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー 小野寺健小野寺健
提出日時 2021-11-09 08:55:43
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-28 23:00:44
合計ジャッジ時間 22,036 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 259 ms
11,904 KB
testcase_02 AC 107 ms
12,160 KB
testcase_03 AC 278 ms
12,032 KB
testcase_04 AC 303 ms
12,416 KB
testcase_05 AC 113 ms
12,160 KB
testcase_06 AC 438 ms
12,288 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 551 ms
12,288 KB
testcase_10 AC 636 ms
12,416 KB
testcase_11 AC 775 ms
12,544 KB
testcase_12 AC 93 ms
12,288 KB
testcase_13 AC 90 ms
12,288 KB
testcase_14 AC 93 ms
11,904 KB
testcase_15 AC 93 ms
12,288 KB
testcase_16 AC 91 ms
12,160 KB
testcase_17 AC 402 ms
12,416 KB
testcase_18 AC 238 ms
12,288 KB
testcase_19 AC 514 ms
12,288 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 92 ms
12,160 KB
testcase_24 AC 94 ms
12,160 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 90 ms
12,160 KB
testcase_59 AC 91 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

$N = gets.to_i
$S = gets.strip.split("").map{|s| s == "E" ? 1 : 0}
$A = gets.split(" ").map{|s| s.to_i}
Q = gets.to_i
K = gets.split(" ").map{|s| s.to_i}

def maxEnemy(k)
	maxres = 0
	res = 0
	s = t = sum = 0
	loop {
		while t < $N and sum <= k do
			sum += $A[t]
			res += $S[t]
			t += 1
		end
		if sum <= k then
			maxres = res if res > maxres
			break
		end
		sum -= $A[s]
		res -= $S[s]
		maxres = res if res > maxres
		s += 1
	}
	maxres
end

K.each {|k|
	puts maxEnemy(k)
}
0