結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー pointNpointN
提出日時 2020-02-26 01:04:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,235 bytes
コンパイル時間 1,089 ms
コンパイル使用メモリ 115,944 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 15:49:01
合計ジャッジ時間 3,147 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  ll N; cin >> N;
  string S; cin >> S;
  vector<ll> A(N); rep(i,N) cin >> A[i];
  vector<ll> sums(N+1,0);
  rep(i,N) sums[i+1] = sums[i] + A[i];
  vector<ll> esum(N+1,0);
  rep(i,N) esum[i+1] = esum[i] + ((S[i]=='E')?1:0);
  // rep(i,N+1) cout << esum[i] << " ";
  ll Q; cin >> Q;
  rep(q,Q){
    ll K; cin >> K;
    ll ans=0;
    ll l,r;
    for(l=1,r=1; l<N; l++){
      while(r<N && sums[r+1]-sums[l-1]<=K){
        r++;
      }
      // cout << l << " " << r << " " << esum[r]-esum[l-1] << endl;
      ans = max(ans,esum[r]-esum[l-1]);
    }
    cout << ans << endl;
  }
  return 0;
}
0