結果
| 問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
| コンテスト | |
| ユーザー |
wunderkammer2
|
| 提出日時 | 2019-12-05 23:03:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,177 bytes |
| コンパイル時間 | 740 ms |
| コンパイル使用メモリ | 85,988 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2024-12-23 03:34:24 |
| 合計ジャッジ時間 | 6,290 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 57 TLE * 1 |
ソースコード
#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;
}
wunderkammer2