結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー mikianaaamikianaaa
提出日時 2020-09-01 20:21:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 1,739 ms
コンパイル使用メモリ 168,492 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-12 23:26:43
合計ジャッジ時間 8,144 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,380 KB
testcase_01 AC 33 ms
4,380 KB
testcase_02 AC 4 ms
4,384 KB
testcase_03 AC 41 ms
4,380 KB
testcase_04 AC 45 ms
4,380 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 78 ms
4,384 KB
testcase_07 AC 72 ms
4,380 KB
testcase_08 AC 172 ms
4,380 KB
testcase_09 AC 99 ms
4,380 KB
testcase_10 AC 118 ms
4,380 KB
testcase_11 AC 150 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 54 ms
4,384 KB
testcase_18 AC 30 ms
4,384 KB
testcase_19 AC 80 ms
4,380 KB
testcase_20 AC 58 ms
4,384 KB
testcase_21 AC 6 ms
4,384 KB
testcase_22 AC 3 ms
4,384 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,384 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,384 KB
testcase_31 AC 2 ms
4,384 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 69 ms
4,380 KB
testcase_34 AC 119 ms
4,384 KB
testcase_35 AC 109 ms
4,384 KB
testcase_36 AC 27 ms
4,384 KB
testcase_37 AC 70 ms
4,384 KB
testcase_38 AC 72 ms
4,384 KB
testcase_39 AC 130 ms
4,384 KB
testcase_40 AC 144 ms
4,380 KB
testcase_41 AC 141 ms
4,384 KB
testcase_42 AC 106 ms
4,380 KB
testcase_43 AC 149 ms
4,380 KB
testcase_44 AC 46 ms
4,380 KB
testcase_45 AC 150 ms
4,380 KB
testcase_46 AC 13 ms
4,380 KB
testcase_47 AC 57 ms
4,380 KB
testcase_48 AC 43 ms
4,380 KB
testcase_49 AC 51 ms
4,384 KB
testcase_50 AC 61 ms
4,380 KB
testcase_51 AC 77 ms
4,384 KB
testcase_52 AC 74 ms
4,380 KB
testcase_53 AC 130 ms
4,380 KB
testcase_54 AC 26 ms
4,384 KB
testcase_55 AC 5 ms
4,380 KB
testcase_56 AC 96 ms
4,384 KB
testcase_57 AC 65 ms
4,384 KB
testcase_58 AC 2 ms
4,384 KB
testcase_59 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    string s;
    cin >> s;
    vector<ll> A(N + 1, 0), ene;
    ene.push_back(0);
    rep(i, N) { cin >> A[i + 1]; }

    rep(i, N) { A[i + 1] += A[i]; }
    rep(i, N) {
        if (s[i] == 'E')
            ene.push_back(1);
        else
            ene.push_back(0);
    }

    rep(i, N) { ene[i + 1] += ene[i]; }

    int Q;
    cin >> Q;
    rep(i, Q) {
        ll q;
        cin >> q;
        ll ans = 0;
        rep(j, N + 1) {
            ll tmp = upper_bound(all(A), A[j] + q) - A.begin() - 1;
            ans = max(ans, ene[tmp] - ene[j]);
        }

        cout << ans << endl;
    }
}
0