結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
コンテスト
ユーザー vjudge1
提出日時 2026-01-03 17:58:57
言語 Python3
(3.14.2 + numpy 2.4.0 + scipy 1.16.3)
結果
RE  
実行時間 -
コード長 990 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 632 ms
コンパイル使用メモリ 21,660 KB
実行使用メモリ 20,952 KB
最終ジャッジ日時 2026-01-03 17:59:21
合計ジャッジ時間 21,963 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other AC * 1 RE * 57
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code


def max_foes_defeated(n, S, A, Q, K_list):
    results = []
    
    for K in K_list:
        max_defeated = 0
        
        for start in range(n):
            sharpness = K
            defeated = 0
            
            for i in range(start, n):
                if sharpness <= 0:
                    break
                
                if A[i] <= sharpness:
                    sharpness -= A[i]
                    if S[i] == 'E':
                        defeated += 1
                else:
                    break
            
            max_defeated = max(max_defeated, defeated)
        
        results.append(max_defeated)
    
    return results

if __name__ == "__main__":
    n = int(input().strip())
    S = input().strip()
    A = list(map(int, input().strip().split()))
    Q = int(input().strip())
    K_list = [int(input().strip()) for _ in range(Q)]
    
    results = max_foes_defeated(n, S, A, Q, K_list)
    
    for res in results:
        print(res)




0