結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
コンテスト
ユーザー uzzy
提出日時 2019-11-29 22:39:58
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 22 ms / 2,000 ms
+ 12µs
コード長 1,046 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,938 ms
コンパイル使用メモリ 219,088 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-28 04:40:41
合計ジャッジ時間 4,707 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N;
	cin >> N;
	string S;
	cin >> S;
	int A[2000];
	rep(i, N) cin >> A[i];

	int Q;
	cin >> Q;
	rep(i, Q) {
		int K;
		cin >> K;

		int k = 0;
		int kei = 0;
		int kazu = 0;
		int saidai = 0;
		rep(j, N) {
			while (k < N && kei + A[k] <= K) {
				kei += A[k];
				if (S[k] == 'E') kazu++;
				k++;
			}
			chmax(saidai, kazu);
			if (j == k) {
				k++;
			}
			else {
				kei -= A[j];
				if (S[j] == 'E') kazu--;
			}
		}

		co(saidai);
	}




	Would you please return 0;
}
0