結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー KKT89KKT89
提出日時 2020-06-20 11:02:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 1,009 ms
コンパイル使用メモリ 102,732 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 17:02:44
合計ジャッジ時間 5,065 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 8 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 10 ms
4,376 KB
testcase_04 AC 11 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 22 ms
4,376 KB
testcase_07 AC 20 ms
4,380 KB
testcase_08 AC 46 ms
4,376 KB
testcase_09 AC 30 ms
4,380 KB
testcase_10 AC 34 ms
4,380 KB
testcase_11 AC 50 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 56 ms
4,380 KB
testcase_18 AC 13 ms
4,376 KB
testcase_19 AC 32 ms
4,380 KB
testcase_20 AC 24 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 24 ms
4,380 KB
testcase_34 AC 43 ms
4,376 KB
testcase_35 AC 38 ms
4,380 KB
testcase_36 AC 10 ms
4,376 KB
testcase_37 AC 25 ms
4,376 KB
testcase_38 AC 25 ms
4,380 KB
testcase_39 AC 45 ms
4,376 KB
testcase_40 AC 50 ms
4,380 KB
testcase_41 AC 48 ms
4,376 KB
testcase_42 AC 36 ms
4,380 KB
testcase_43 AC 50 ms
4,376 KB
testcase_44 AC 18 ms
4,380 KB
testcase_45 AC 50 ms
4,380 KB
testcase_46 AC 6 ms
4,380 KB
testcase_47 AC 21 ms
4,380 KB
testcase_48 AC 15 ms
4,380 KB
testcase_49 AC 18 ms
4,380 KB
testcase_50 AC 22 ms
4,376 KB
testcase_51 AC 27 ms
4,380 KB
testcase_52 AC 26 ms
4,376 KB
testcase_53 AC 43 ms
4,380 KB
testcase_54 AC 10 ms
4,376 KB
testcase_55 AC 3 ms
4,376 KB
testcase_56 AC 35 ms
4,376 KB
testcase_57 AC 22 ms
4,380 KB
testcase_58 AC 2 ms
4,376 KB
testcase_59 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <deque>
#include <queue>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string s; cin >> s;
    vector<ll> a(n),sum(n+1);
    vector<int> e(n+1);
    for(int i=0;i<n;i++){
        cin >> a[i];
        sum[i+1]=sum[i]+a[i];
        e[i+1]=e[i]+(s[i]=='E');
    }
    int q; cin >> q;
    int res;
    while(q--){
        res=0;
        ll k; cin >> k;
        for(int i=0;i<=n;i++){
            int r=upper_bound(sum.begin()+i,sum.end(),sum[i]+k)-sum.begin();
            res=max(res,e[r-1]-e[i]);
        }
        printf("%d\n",res);
    }
}
0