結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー tcltktcltk
提出日時 2021-01-16 10:35:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 1,269 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 87,476 KB
最終ジャッジ日時 2023-08-18 06:58:51
合計ジャッジ時間 20,227 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 266 ms
86,504 KB
testcase_01 AC 254 ms
84,412 KB
testcase_02 AC 242 ms
83,572 KB
testcase_03 AC 253 ms
84,740 KB
testcase_04 AC 255 ms
86,836 KB
testcase_05 AC 245 ms
84,056 KB
testcase_06 AC 281 ms
87,200 KB
testcase_07 AC 281 ms
86,932 KB
testcase_08 AC 304 ms
86,608 KB
testcase_09 AC 291 ms
86,960 KB
testcase_10 AC 305 ms
86,728 KB
testcase_11 AC 349 ms
87,364 KB
testcase_12 AC 235 ms
83,252 KB
testcase_13 AC 246 ms
83,204 KB
testcase_14 AC 244 ms
83,188 KB
testcase_15 AC 238 ms
83,356 KB
testcase_16 AC 235 ms
83,108 KB
testcase_17 AC 331 ms
86,632 KB
testcase_18 AC 284 ms
86,804 KB
testcase_19 AC 313 ms
87,320 KB
testcase_20 AC 305 ms
86,904 KB
testcase_21 AC 268 ms
86,824 KB
testcase_22 AC 256 ms
85,548 KB
testcase_23 AC 247 ms
83,608 KB
testcase_24 AC 267 ms
85,768 KB
testcase_25 AC 255 ms
83,844 KB
testcase_26 AC 244 ms
83,512 KB
testcase_27 AC 242 ms
82,932 KB
testcase_28 AC 261 ms
86,372 KB
testcase_29 AC 253 ms
83,580 KB
testcase_30 AC 247 ms
83,576 KB
testcase_31 AC 257 ms
83,644 KB
testcase_32 AC 259 ms
85,952 KB
testcase_33 AC 299 ms
87,160 KB
testcase_34 AC 347 ms
87,072 KB
testcase_35 AC 328 ms
87,236 KB
testcase_36 AC 281 ms
86,580 KB
testcase_37 AC 300 ms
87,208 KB
testcase_38 AC 325 ms
86,904 KB
testcase_39 AC 344 ms
87,412 KB
testcase_40 AC 336 ms
86,844 KB
testcase_41 AC 355 ms
87,432 KB
testcase_42 AC 324 ms
86,904 KB
testcase_43 AC 343 ms
87,388 KB
testcase_44 AC 296 ms
86,832 KB
testcase_45 AC 345 ms
87,272 KB
testcase_46 AC 278 ms
87,116 KB
testcase_47 AC 307 ms
87,080 KB
testcase_48 AC 291 ms
86,936 KB
testcase_49 AC 304 ms
87,036 KB
testcase_50 AC 320 ms
87,476 KB
testcase_51 AC 310 ms
86,964 KB
testcase_52 AC 300 ms
86,932 KB
testcase_53 AC 335 ms
87,228 KB
testcase_54 AC 276 ms
86,744 KB
testcase_55 AC 269 ms
86,812 KB
testcase_56 AC 317 ms
87,068 KB
testcase_57 AC 295 ms
86,944 KB
testcase_58 AC 241 ms
83,256 KB
testcase_59 AC 244 ms
83,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """10
# EEEEEEEEEE
# 1 2 3 4 5 6 7 8 9 10
# 10
# 1 2 3 4 5 6 7 8 9 10
# """
# sys.stdin = io.StringIO(_INPUT)



def main():
    N = int(input())
    S = input()
    A = list(map(int, input().split()))
    Q = int(input())
    K = list(map(int, input().split()))

    # T[i] := A[0]~A[i-1] を倒すのに必要な威力(累積和)
    T = [0]
    # C[i] := A[0]~A[i-1] の間の敵の数
    C = [0]
    for i in range(N):
        T.append(T[-1] + A[i])
        if S[i] == 'E':
            C.append(C[-1] + 1)
        else:
            C.append(C[-1])

    for power in K:
        score = 0
        r = 0
        for l in range(N):
            while r < N and T[r+1] - T[l] <= power:
                r += 1
            score1 = C[r] - C[l]
            score = max(score, score1)

            if r == l:
                r += 1
        print(score)

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