結果
問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
ユーザー |
|
提出日時 | 2020-04-13 15:22:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 210 ms / 2,000 ms |
コード長 | 971 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 81,988 KB |
実行使用メモリ | 78,060 KB |
最終ジャッジ日時 | 2024-09-25 01:16:03 |
合計ジャッジ時間 | 8,707 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 58 |
ソースコード
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()