結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-11-29 22:21:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 218 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 1,365 ms
コンパイル使用メモリ 148,000 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-12 06:24:40
合計ジャッジ時間 7,224 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,352 KB
testcase_01 AC 42 ms
4,348 KB
testcase_02 AC 4 ms
4,348 KB
testcase_03 AC 54 ms
4,348 KB
testcase_04 AC 57 ms
4,352 KB
testcase_05 AC 8 ms
4,348 KB
testcase_06 AC 102 ms
4,348 KB
testcase_07 AC 88 ms
4,348 KB
testcase_08 AC 218 ms
4,348 KB
testcase_09 AC 125 ms
4,352 KB
testcase_10 AC 148 ms
4,352 KB
testcase_11 AC 189 ms
4,356 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 53 ms
4,352 KB
testcase_18 AC 36 ms
4,348 KB
testcase_19 AC 107 ms
4,352 KB
testcase_20 AC 74 ms
4,348 KB
testcase_21 AC 8 ms
4,348 KB
testcase_22 AC 4 ms
4,348 KB
testcase_23 AC 2 ms
4,352 KB
testcase_24 AC 2 ms
4,352 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,352 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 3 ms
4,476 KB
testcase_33 AC 89 ms
4,348 KB
testcase_34 AC 147 ms
4,352 KB
testcase_35 AC 135 ms
4,480 KB
testcase_36 AC 33 ms
4,348 KB
testcase_37 AC 87 ms
4,348 KB
testcase_38 AC 92 ms
4,352 KB
testcase_39 AC 160 ms
4,352 KB
testcase_40 AC 178 ms
4,352 KB
testcase_41 AC 177 ms
4,356 KB
testcase_42 AC 135 ms
4,348 KB
testcase_43 AC 184 ms
4,348 KB
testcase_44 AC 59 ms
4,352 KB
testcase_45 AC 188 ms
4,348 KB
testcase_46 AC 17 ms
4,352 KB
testcase_47 AC 74 ms
4,352 KB
testcase_48 AC 51 ms
4,348 KB
testcase_49 AC 65 ms
4,348 KB
testcase_50 AC 75 ms
4,348 KB
testcase_51 AC 95 ms
4,352 KB
testcase_52 AC 94 ms
4,348 KB
testcase_53 AC 163 ms
4,348 KB
testcase_54 AC 33 ms
4,352 KB
testcase_55 AC 6 ms
4,352 KB
testcase_56 AC 118 ms
4,352 KB
testcase_57 AC 81 ms
4,348 KB
testcase_58 AC 2 ms
4,348 KB
testcase_59 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;



int main() {
    int n; cin >> n;
    string s; cin >> s;
    vector<int> a(n);
    vector<ll> sum(n + 1), enemy(n + 1);
    sum[0] = 0;
    enemy[0] = 0;
    REP(i, n) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
        enemy[i + 1] = enemy[i];
        if (s[i] == 'E') enemy[i + 1]++;
    }
    int q; cin >> q;
    REP(i, q) {
        int k; cin >> k;
        ll ans = 0;
        REP(j, n) {
            ans = max(ans,enemy[upper_bound(sum.begin(), sum.end(), k + sum[j]) - sum.begin() - 1] - enemy[j]);
        }
        cout << ans << endl;
    }
    return 0;
}
0