結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー tonyu0tonyu0
提出日時 2019-11-29 22:53:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 792 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 106,940 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-05-01 00:42:02
合計ジャッジ時間 4,755 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr int INF = 1 << 30;

int N, Q, K;
string S;

int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> N >> S;
  vector<ll> A(N), SE(N+1), SK(N+1);
  for(int i = 0; i < N; ++i) cin >> A[i];
  for(int i = 0; i < N; ++i) {
    SE[i+1] = SE[i] + (S[i] == 'E');
    SK[i+1] = SK[i] + A[i];
  }

  cin >> Q;
  for(int i = 0; i < Q; ++i) {
    cin >> K;
    ll ans = 0;
    for(int j = 0; j < N; ++j) {
      for(int k = j + 1; k <= N; ++k) {
        if(SK[k] - SK[j] > K) break;
        ans = max(ans, SE[k] - SE[j]);
      }
    }
    cout << ans << '\n';
  }

  return 0;
}
0