結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー convexineqconvexineq
提出日時 2019-11-29 22:23:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 78,540 KB
最終ジャッジ日時 2023-10-12 06:26:29
合計ジャッジ時間 11,250 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
78,236 KB
testcase_01 AC 134 ms
77,616 KB
testcase_02 AC 99 ms
76,684 KB
testcase_03 AC 128 ms
77,588 KB
testcase_04 AC 142 ms
77,892 KB
testcase_05 AC 101 ms
76,268 KB
testcase_06 AC 158 ms
77,852 KB
testcase_07 AC 161 ms
78,260 KB
testcase_08 AC 229 ms
78,272 KB
testcase_09 AC 183 ms
77,940 KB
testcase_10 AC 203 ms
78,536 KB
testcase_11 AC 200 ms
78,540 KB
testcase_12 AC 70 ms
71,452 KB
testcase_13 AC 72 ms
71,476 KB
testcase_14 AC 71 ms
71,564 KB
testcase_15 AC 71 ms
71,532 KB
testcase_16 AC 72 ms
71,188 KB
testcase_17 AC 149 ms
77,000 KB
testcase_18 AC 144 ms
78,236 KB
testcase_19 AC 170 ms
77,280 KB
testcase_20 AC 160 ms
77,400 KB
testcase_21 AC 112 ms
77,308 KB
testcase_22 AC 87 ms
75,912 KB
testcase_23 AC 91 ms
76,024 KB
testcase_24 AC 96 ms
76,104 KB
testcase_25 AC 103 ms
76,128 KB
testcase_26 AC 83 ms
76,156 KB
testcase_27 AC 78 ms
71,268 KB
testcase_28 AC 103 ms
76,172 KB
testcase_29 AC 93 ms
76,200 KB
testcase_30 AC 93 ms
76,056 KB
testcase_31 AC 99 ms
76,052 KB
testcase_32 AC 99 ms
76,056 KB
testcase_33 AC 168 ms
77,944 KB
testcase_34 AC 227 ms
77,668 KB
testcase_35 AC 197 ms
77,900 KB
testcase_36 AC 120 ms
76,736 KB
testcase_37 AC 178 ms
77,904 KB
testcase_38 AC 166 ms
76,764 KB
testcase_39 AC 226 ms
77,684 KB
testcase_40 AC 229 ms
77,976 KB
testcase_41 AC 227 ms
78,120 KB
testcase_42 AC 194 ms
76,920 KB
testcase_43 AC 232 ms
77,960 KB
testcase_44 AC 157 ms
78,228 KB
testcase_45 AC 244 ms
78,048 KB
testcase_46 AC 112 ms
76,692 KB
testcase_47 AC 158 ms
77,960 KB
testcase_48 AC 146 ms
77,308 KB
testcase_49 AC 149 ms
77,988 KB
testcase_50 AC 163 ms
78,116 KB
testcase_51 AC 175 ms
78,436 KB
testcase_52 AC 176 ms
78,416 KB
testcase_53 AC 229 ms
78,136 KB
testcase_54 AC 144 ms
78,156 KB
testcase_55 AC 110 ms
76,916 KB
testcase_56 AC 194 ms
78,108 KB
testcase_57 AC 175 ms
78,148 KB
testcase_58 AC 76 ms
71,452 KB
testcase_59 AC 76 ms
71,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
 
#h,w,k = [int(i) for i in readline().split()]
#n = int(input())
#ab = [[int(i) for i in readline().split()] for _ in range(n)]


n = int(input())
s = input()
a = [int(i) for i in readline().split()]
q = int(input())
k = [int(i) for i in readline().split()]


for ki in k:
    res = 0
    val = 0
    ans = 0
    r = 0
    for l in range(n):
        while r < n and res+a[r] <= ki:
            if s[r] == "E": val += 1
            res += a[r]
            r += 1
        #print(val,res,ki,ans)
        ans = max(ans, val)
        if s[l] == "E": val -= 1
        res -= a[l]

    print(ans)
    
    
    
    
    
0