結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー mint6421mint6421
提出日時 2019-11-30 22:12:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,551 bytes
コンパイル時間 1,419 ms
コンパイル使用メモリ 166,908 KB
実行使用メモリ 12,872 KB
最終ジャッジ日時 2023-08-13 09:46:42
合計ジャッジ時間 11,679 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
4,376 KB
testcase_01 AC 34 ms
7,780 KB
testcase_02 AC 7 ms
9,392 KB
testcase_03 AC 50 ms
10,844 KB
testcase_04 RE -
testcase_05 AC 11 ms
10,772 KB
testcase_06 AC 93 ms
11,044 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 110 ms
10,860 KB
testcase_20 RE -
testcase_21 AC 11 ms
4,848 KB
testcase_22 AC 8 ms
10,308 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 3 ms
4,380 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 4 ms
4,376 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 35 ms
12,224 KB
testcase_37 RE -
testcase_38 AC 93 ms
11,860 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 49 ms
7,432 KB
testcase_45 RE -
testcase_46 AC 17 ms
5,028 KB
testcase_47 AC 68 ms
10,412 KB
testcase_48 RE -
testcase_49 AC 63 ms
10,544 KB
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 7 ms
4,952 KB
testcase_56 RE -
testcase_57 RE -
testcase_58 AC 1 ms
4,376 KB
testcase_59 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}

int s[1100][1100];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  cin>>n;
  string t;
  cin>>t;
  vi v(n+1,0);
  FOR(i,1,n+1){
    v[i]+=v[i-1];
    if(t[i-1]=='E') v[i]++;
  }

  vi a(n+1,0);
  FOR(i,1,n+1){
    cin>>a[i];
  
  }

  rep(i,n+1){
    FOR(j,i,n+1){
      s[i][j]=a[j];
      s[i][j]+=s[i][j-1];
    }
  }

  int q;
  cin>>q;
  while(q--){
    int k;
    cin>>k;
    int ans=0;
    rep(i,n+1){
      int l=i,r=n+1;
      while(r-l>1){
        int m=(r+l)/2;
        if(s[i][m]-s[i][i]>k) r=m;
        else l=m;
      }
      //cout<<' '<<l<<endl;
      //cout<<l<<' '<<i<<endl;
      ans=max(ans,v[l]-v[i]);
    }
    cout<<ans<<endl;
  }



}
0