結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー iqueue02iqueue02
提出日時 2019-11-29 22:24:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 826 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 171,808 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 00:36:01
合計ジャッジ時間 6,496 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
6,816 KB
testcase_02 AC 5 ms
6,944 KB
testcase_03 AC 45 ms
6,940 KB
testcase_04 WA -
testcase_05 AC 7 ms
6,940 KB
testcase_06 AC 86 ms
6,944 KB
testcase_07 AC 76 ms
6,944 KB
testcase_08 AC 199 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 129 ms
6,944 KB
testcase_11 AC 170 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,944 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 67 ms
6,940 KB
testcase_21 AC 7 ms
6,940 KB
testcase_22 AC 4 ms
6,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 80 ms
6,940 KB
testcase_34 AC 130 ms
6,940 KB
testcase_35 AC 121 ms
6,944 KB
testcase_36 AC 29 ms
6,940 KB
testcase_37 AC 78 ms
6,944 KB
testcase_38 WA -
testcase_39 AC 140 ms
6,944 KB
testcase_40 AC 156 ms
6,944 KB
testcase_41 AC 155 ms
6,944 KB
testcase_42 WA -
testcase_43 AC 163 ms
6,944 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 16 ms
6,940 KB
testcase_47 AC 62 ms
6,940 KB
testcase_48 WA -
testcase_49 AC 55 ms
6,944 KB
testcase_50 AC 65 ms
6,940 KB
testcase_51 AC 81 ms
6,940 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 29 ms
6,944 KB
testcase_55 AC 6 ms
6,944 KB
testcase_56 WA -
testcase_57 AC 69 ms
6,944 KB
testcase_58 AC 2 ms
6,940 KB
testcase_59 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int Q;
  cin >> Q;
  vector<int> q(Q);
  rep(i,Q) cin >> q[i];

  vector<int> num(n+1,0);
  vector<ll> k(n+1,0);
  rep(i,n) {
    if (s[i] == 'E') num[i+1] = num[i] + 1;
    else num[i+1] = num[i];
  }
  rep(i,n) {
    k[i+1] = k[i] + a[i];
  }

  for (auto e : q) {
    ll tmp = e;
    int cur = 0;
    int res = 0;
    rep(i,n) {
      auto itr = lower_bound(k.begin(), k.end(), tmp) - k.begin();
      if (k[itr] > e) itr--;
      res = max(num[itr] - cur, res);
      tmp += a[i];
      cur = num[i+1];
    }
    cout << res << endl;
  }

  return 0;
}
0