結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー wunderkammer2wunderkammer2
提出日時 2019-12-05 23:03:36
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,177 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 84,684 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-24 18:51:45
合計ジャッジ時間 6,421 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,768 KB
testcase_01 AC 5 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 10 ms
4,376 KB
testcase_08 AC 21 ms
4,376 KB
testcase_09 AC 14 ms
4,380 KB
testcase_10 AC 16 ms
4,380 KB
testcase_11 AC 25 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 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<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

int main()
{	
	int n;
	cin >> n;

	string s;
	cin >> s;

	vector<ll> as(n);
	rep(i, n) cin >> as[i];


	int q;
	cin >> q;

	vector<ll> ks(q);
	rep(i, q) cin >> ks[i];


	for (auto k : ks)
	{
		ll maxCount = 0;

		//倒せる敵の数の最大値を尺取り法で計算
		rep(left, n)
		{
			int right = left;

			ll count = 0;
			ll power = k;
			while (right < n)
			{
				//威力が足りない場合は終了
				if (power < as[right]) break;

				//敵破壊数をカウントアップ
				if (s[right] == 'E') count++;

				//威力減衰
				power -= as[right];

				right++;
			}

			//最大値更新
			maxCount = max(maxCount, count);
		}

		cout << maxCount << endl;
	}
	return 0;
}
0