結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー terasaterasa
提出日時 2022-06-06 18:55:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 1,227 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 81,600 KB
実行使用メモリ 77,108 KB
最終ジャッジ日時 2023-10-21 03:40:12
合計ジャッジ時間 10,013 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
73,524 KB
testcase_01 AC 94 ms
72,812 KB
testcase_02 AC 65 ms
67,936 KB
testcase_03 AC 92 ms
70,716 KB
testcase_04 AC 103 ms
74,244 KB
testcase_05 AC 62 ms
66,252 KB
testcase_06 AC 127 ms
73,988 KB
testcase_07 AC 130 ms
76,704 KB
testcase_08 AC 197 ms
76,712 KB
testcase_09 AC 157 ms
77,108 KB
testcase_10 AC 170 ms
76,968 KB
testcase_11 AC 171 ms
74,360 KB
testcase_12 AC 46 ms
55,576 KB
testcase_13 AC 46 ms
55,576 KB
testcase_14 AC 45 ms
55,576 KB
testcase_15 AC 44 ms
55,576 KB
testcase_16 AC 45 ms
55,576 KB
testcase_17 AC 100 ms
70,704 KB
testcase_18 AC 102 ms
72,824 KB
testcase_19 AC 150 ms
76,316 KB
testcase_20 AC 135 ms
74,208 KB
testcase_21 AC 95 ms
76,380 KB
testcase_22 AC 61 ms
65,788 KB
testcase_23 AC 61 ms
65,860 KB
testcase_24 AC 69 ms
69,972 KB
testcase_25 AC 67 ms
70,012 KB
testcase_26 AC 53 ms
63,712 KB
testcase_27 AC 47 ms
55,576 KB
testcase_28 AC 73 ms
72,732 KB
testcase_29 AC 70 ms
70,012 KB
testcase_30 AC 64 ms
67,928 KB
testcase_31 AC 63 ms
67,864 KB
testcase_32 AC 61 ms
65,772 KB
testcase_33 AC 148 ms
76,956 KB
testcase_34 AC 197 ms
76,812 KB
testcase_35 AC 172 ms
76,700 KB
testcase_36 AC 107 ms
76,984 KB
testcase_37 AC 142 ms
76,720 KB
testcase_38 AC 140 ms
74,196 KB
testcase_39 AC 201 ms
76,324 KB
testcase_40 AC 201 ms
76,436 KB
testcase_41 AC 205 ms
76,320 KB
testcase_42 AC 173 ms
76,704 KB
testcase_43 AC 209 ms
76,720 KB
testcase_44 AC 120 ms
76,696 KB
testcase_45 AC 211 ms
76,308 KB
testcase_46 AC 95 ms
76,696 KB
testcase_47 AC 126 ms
73,588 KB
testcase_48 AC 113 ms
72,956 KB
testcase_49 AC 114 ms
72,964 KB
testcase_50 AC 130 ms
72,936 KB
testcase_51 AC 146 ms
73,784 KB
testcase_52 AC 144 ms
76,960 KB
testcase_53 AC 198 ms
76,812 KB
testcase_54 AC 98 ms
73,308 KB
testcase_55 AC 67 ms
67,844 KB
testcase_56 AC 170 ms
76,712 KB
testcase_57 AC 129 ms
72,820 KB
testcase_58 AC 45 ms
55,576 KB
testcase_59 AC 44 ms
55,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N = int(input())
S = input()[:-1]
A = list(map(int, input().split()))
Q = int(input())
K = list(map(int, input().split()))

for i in range(Q):
    l = 0
    r = 1
    acc = 0
    cnt = 0
    ans = 0
    while r <= N:
        acc += A[r - 1]
        if S[r - 1] == 'E':
            cnt += 1
        while acc > K[i]:
            acc -= A[l]
            if S[l] == 'E':
                cnt -= 1
            l += 1
        ans = max(ans, cnt)
        r += 1
    print(ans)
0