結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー hedwig100hedwig100
提出日時 2020-04-13 15:22:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 971 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 77,240 KB
最終ジャッジ日時 2023-10-25 05:51:51
合計ジャッジ時間 9,111 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
76,540 KB
testcase_01 AC 69 ms
72,720 KB
testcase_02 AC 56 ms
65,756 KB
testcase_03 AC 76 ms
72,868 KB
testcase_04 AC 73 ms
73,100 KB
testcase_05 AC 61 ms
68,164 KB
testcase_06 AC 114 ms
76,664 KB
testcase_07 AC 110 ms
76,492 KB
testcase_08 AC 158 ms
76,684 KB
testcase_09 AC 126 ms
76,872 KB
testcase_10 AC 135 ms
76,764 KB
testcase_11 AC 169 ms
76,564 KB
testcase_12 AC 49 ms
60,956 KB
testcase_13 AC 49 ms
60,956 KB
testcase_14 AC 48 ms
60,956 KB
testcase_15 AC 47 ms
60,956 KB
testcase_16 AC 49 ms
60,956 KB
testcase_17 AC 182 ms
76,460 KB
testcase_18 AC 111 ms
76,640 KB
testcase_19 AC 167 ms
76,816 KB
testcase_20 AC 135 ms
76,636 KB
testcase_21 AC 103 ms
76,888 KB
testcase_22 AC 76 ms
72,720 KB
testcase_23 AC 63 ms
67,776 KB
testcase_24 AC 81 ms
75,688 KB
testcase_25 AC 67 ms
71,992 KB
testcase_26 AC 49 ms
63,520 KB
testcase_27 AC 47 ms
60,956 KB
testcase_28 AC 69 ms
72,652 KB
testcase_29 AC 60 ms
69,824 KB
testcase_30 AC 59 ms
67,760 KB
testcase_31 AC 66 ms
69,916 KB
testcase_32 AC 66 ms
69,924 KB
testcase_33 AC 138 ms
76,636 KB
testcase_34 AC 185 ms
76,632 KB
testcase_35 AC 154 ms
76,548 KB
testcase_36 AC 99 ms
76,536 KB
testcase_37 AC 131 ms
76,588 KB
testcase_38 AC 144 ms
76,688 KB
testcase_39 AC 195 ms
77,112 KB
testcase_40 AC 202 ms
76,856 KB
testcase_41 AC 208 ms
76,816 KB
testcase_42 AC 155 ms
76,572 KB
testcase_43 AC 189 ms
76,884 KB
testcase_44 AC 124 ms
76,848 KB
testcase_45 AC 193 ms
76,660 KB
testcase_46 AC 95 ms
76,696 KB
testcase_47 AC 133 ms
76,572 KB
testcase_48 AC 108 ms
76,592 KB
testcase_49 AC 122 ms
76,644 KB
testcase_50 AC 133 ms
76,680 KB
testcase_51 AC 136 ms
76,880 KB
testcase_52 AC 132 ms
76,560 KB
testcase_53 AC 187 ms
77,240 KB
testcase_54 AC 94 ms
76,488 KB
testcase_55 AC 82 ms
76,484 KB
testcase_56 AC 154 ms
77,084 KB
testcase_57 AC 125 ms
76,764 KB
testcase_58 AC 47 ms
60,956 KB
testcase_59 AC 48 ms
60,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque
from heapq import heapify,heappush,heappop
from copy import deepcopy

def main():
    n = int(input())
    s = input()
    a = list(map(int,input().split()))
    q = int(input())
    query = list(map(int,input().split()))

    for index in range(q):
        t = query[index]
        r = 0
        tot = 0
        ans = 0
        cnt = 0
        for l in range(n):
            while r < n and tot + a[r] <= t:
                if s[r] == 'E':
                    cnt += 1
                tot += a[r]
                r += 1
            
            ans = max(ans,cnt)
            if l == r:
                r += 1
                cnt = 0
                tot = 0
            else:
                if s[l] == 'E':
                    cnt -= 1
                tot -= a[l]
        
        print(ans)

if __name__ == '__main__':
    main()
0