結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー season1618season1618
提出日時 2019-11-29 22:36:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 832 bytes
コンパイル時間 1,517 ms
コンパイル使用メモリ 165,952 KB
実行使用メモリ 34,588 KB
最終ジャッジ日時 2023-10-12 06:29:11
合計ジャッジ時間 5,920 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,348 KB
testcase_01 AC 15 ms
6,080 KB
testcase_02 AC 4 ms
6,896 KB
testcase_03 AC 20 ms
10,292 KB
testcase_04 AC 29 ms
17,580 KB
testcase_05 AC 7 ms
10,044 KB
testcase_06 AC 39 ms
10,756 KB
testcase_07 AC 41 ms
12,676 KB
testcase_08 AC 124 ms
32,312 KB
testcase_09 AC 63 ms
19,404 KB
testcase_10 AC 76 ms
20,136 KB
testcase_11 AC 113 ms
28,816 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 131 ms
34,588 KB
testcase_18 AC 27 ms
19,284 KB
testcase_19 AC 51 ms
10,620 KB
testcase_20 AC 50 ms
25,932 KB
testcase_21 AC 6 ms
4,352 KB
testcase_22 AC 5 ms
9,136 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,352 KB
testcase_25 AC 2 ms
4,352 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,352 KB
testcase_32 AC 2 ms
4,352 KB
testcase_33 AC 58 ms
29,276 KB
testcase_34 AC 81 ms
21,216 KB
testcase_35 AC 79 ms
22,740 KB
testcase_36 AC 17 ms
11,392 KB
testcase_37 AC 54 ms
25,148 KB
testcase_38 AC 41 ms
10,732 KB
testcase_39 AC 88 ms
22,020 KB
testcase_40 AC 98 ms
23,464 KB
testcase_41 AC 98 ms
23,748 KB
testcase_42 AC 78 ms
25,812 KB
testcase_43 AC 104 ms
24,896 KB
testcase_44 AC 24 ms
5,728 KB
testcase_45 AC 108 ms
32,344 KB
testcase_46 AC 9 ms
4,348 KB
testcase_47 AC 30 ms
8,772 KB
testcase_48 AC 34 ms
20,132 KB
testcase_49 AC 28 ms
9,428 KB
testcase_50 AC 45 ms
19,592 KB
testcase_51 AC 51 ms
16,584 KB
testcase_52 AC 49 ms
15,516 KB
testcase_53 AC 107 ms
32,432 KB
testcase_54 AC 21 ms
15,624 KB
testcase_55 AC 4 ms
4,348 KB
testcase_56 AC 67 ms
22,624 KB
testcase_57 AC 40 ms
13,548 KB
testcase_58 AC 2 ms
4,348 KB
testcase_59 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const int mod=1e5;
const int size=1e5;
const long inf=1e9;
int main(){
	int N;cin>>N;
	string s;cin>>s;
	int E[N+1];E[0]=0;
	rep(i,1,N+1){
		if(s[i-1]=='E') E[i]=E[i-1]+1;
		else E[i]=E[i-1];
	}
	long A[N+1][N+1];A[0][0]=0; long a;
	rep(i,1,N+1){
		cin>>a;
		A[0][i]=A[0][i-1]+a;
	}rep(i,1,N+1)rep(j,0,N+1-i){
        A[i][j]=A[0][i+j]-A[0][i];
    }
    //pprint(A,N+1,N+1);
	int Q;long k;
    cin>>Q;
	rep(i,0,Q){
		cin>>k;
        int res=0;int id;
        rep(j,0,N+1){
		    id=upper_bound(A[j],A[j]+N+1-j,k)-1-A[j];
            res=max(res,E[j+id]-E[j]);
        }cout<<res<<endl;
	}
}
0