結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-01-16 10:33:30 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,139 bytes | 
| コンパイル時間 | 171 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 184,960 KB | 
| 最終ジャッジ日時 | 2024-11-27 10:29:44 | 
| 合計ジャッジ時間 | 21,867 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 57 TLE * 1 | 
ソースコード
#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]
    for i in range(N):
        T.append(T[-1] + A[i])
    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 = len([1 for i in range(l, r) if S[i] == 'E'])
            score = max(score, score1)
            if r == l:
                r += 1
        print(score)
if __name__ == '__main__':
    main()
            
            
            
        