結果
| 問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
| コンテスト | |
| ユーザー |
season1618
|
| 提出日時 | 2019-11-29 22:36:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 110 ms / 2,000 ms |
| コード長 | 832 bytes |
| コンパイル時間 | 1,500 ms |
| コンパイル使用メモリ | 167,692 KB |
| 実行使用メモリ | 33,708 KB |
| 最終ジャッジ日時 | 2024-09-14 05:50:58 |
| 合計ジャッジ時間 | 5,094 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
#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;
}
}
season1618