結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー |
![]() |
提出日時 | 2020-02-08 20:19:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 638 ms |
コンパイル使用メモリ | 71,908 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 05:21:57 |
合計ジャッジ時間 | 3,285 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 58 |
ソースコード
#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];enemy.push_back(2e9);cin >> q;for (int i = 0; i < q; ++i) {cin >> k;int max_cnt = -1;long long sum = 0;int right = 0, cnt = 0;for (int left = 0; left < n; ++left) {while (k >= sum + enemy[right] && n > right) {sum += enemy[right];if (s[right] == 'E') ++cnt;++right;}max_cnt = max(max_cnt, cnt);sum -= enemy[left];if (s[left] == 'E') --cnt;}cout << max_cnt << endl;}return 0;}