結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー bond_cmprogbond_cmprog
提出日時 2019-12-01 19:39:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,624 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 170,904 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 11:39:39
合計ジャッジ時間 3,965 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 6 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 6 ms
6,940 KB
testcase_04 AC 6 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 12 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 14 ms
6,940 KB
testcase_10 AC 16 ms
6,940 KB
testcase_11 AC 25 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,944 KB
testcase_17 WA -
testcase_18 AC 7 ms
6,940 KB
testcase_19 AC 17 ms
6,940 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 2 ms
6,940 KB
testcase_59 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q;
    string S;
    cin >> N >> S;

    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    vector<ll> cum(N+1);
    REP(i,N){
        if(S[i] == 'E') cum[i] = 1;
        if(i > 0) cum[i] += cum[i-1];
    }

    cin >> Q;
    while(Q--){
        ll x;
        cin >> x;
        ll ans = 0;
        ll sum = 0;
        int r = 0;
        for(int l=0;l<N;l++){
            while(r < N && sum + A[r] <= x){
                sum += A[r];
                r++;
            }
            chmax(ans, cum[r] - cum[l]);
            sum -= A[l];
        }
        cout << ans << endl;
    }
}
0