結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
コンテスト
ユーザー vjudge1
提出日時 2026-01-03 17:43:03
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 1,004 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,526 ms
コンパイル使用メモリ 337,132 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-03 17:43:09
合計ジャッジ時間 5,574 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 21 WA * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//
// c.cpp
// Created by wasifshahzad on 01/03/26 at 12:52:34.
//

#include <bits/stdc++.h>
using namespace std;
#define int long long
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

const int MOD1 = 1e9+7;
const int MOD2 = 998244353;

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int q;
    cin >> q;
    while(q--) {
        int k;
        cin >> k;
        int ans = 0;
        int l = -1, sum = 0, cnt = 0;
        for(int r = 0; r < n; r++) {
            if(sum + a[r] <= k) {
                sum += a[r];
                cnt += s[r] == 'E';
            } else {
                ans = max(ans, cnt);
                sum = 0, cnt = 0;
                l = r;
            }
        }
        cout << ans << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    // cin >> T;
    while(T--) {
        solve();
    }
}
0