結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー ajiruajiru
提出日時 2020-02-08 05:20:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 528 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 70,324 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-09-25 08:42:41
合計ジャッジ時間 5,049 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 17 TLE * 1 -- * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n, q, k;
	string s;
	cin >> n >> s;
	vector<int> enemy(n);
	for (int i = 0; i < n; ++i) cin >> enemy[i];
	cin >> q;
	for (int i = 0; i < q; ++i) {
		cin >> k;
		int max_ans = -1;
		for (int j = 0; j < n; ++j) {
			int beam = k;
			int cnt = j, ans = 0;
			while (beam > 0 && n > cnt) {
				beam -= enemy[cnt];
				if (beam >= 0 && s[cnt] == 'E') ++ans;
				++cnt;
			}
			max_ans = max(max_ans, ans);
		}
		cout << max_ans << endl;
	}
	return 0;
}
0