結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー mint6421mint6421
提出日時 2019-11-30 22:12:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,551 bytes
コンパイル時間 1,537 ms
コンパイル使用メモリ 170,448 KB
実行使用メモリ 12,744 KB
最終ジャッジ日時 2024-05-01 03:17:25
合計ジャッジ時間 10,569 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,816 KB
testcase_01 AC 31 ms
7,168 KB
testcase_02 AC 6 ms
8,404 KB
testcase_03 AC 49 ms
10,848 KB
testcase_04 RE -
testcase_05 AC 13 ms
10,320 KB
testcase_06 AC 92 ms
10,872 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 112 ms
11,240 KB
testcase_20 RE -
testcase_21 AC 10 ms
6,940 KB
testcase_22 AC 7 ms
9,676 KB
testcase_23 AC 3 ms
6,940 KB
testcase_24 AC 3 ms
6,940 KB
testcase_25 AC 3 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 3 ms
6,944 KB
testcase_28 AC 3 ms
6,940 KB
testcase_29 AC 3 ms
6,940 KB
testcase_30 AC 3 ms
6,940 KB
testcase_31 AC 3 ms
6,948 KB
testcase_32 AC 4 ms
6,940 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 33 ms
11,508 KB
testcase_37 RE -
testcase_38 AC 91 ms
10,832 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 49 ms
6,944 KB
testcase_45 RE -
testcase_46 AC 16 ms
6,940 KB
testcase_47 AC 74 ms
9,472 KB
testcase_48 RE -
testcase_49 AC 66 ms
10,072 KB
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 7 ms
6,940 KB
testcase_56 RE -
testcase_57 RE -
testcase_58 AC 2 ms
6,940 KB
testcase_59 AC 2 ms
6,940 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