結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-01-03 21:52:34 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 981 bytes |
| 記録 | |
| コンパイル時間 | 8,604 ms |
| コンパイル使用メモリ | 336,016 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-03 21:52:51 |
| 合計ジャッジ時間 | 6,496 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include <debug.hpp>
#else
#define debug(...) 42
#endif
using namespace std;
#define int long long
void solve(){
int n;
cin >> n;
string s;
cin >> s;
vector<int> a(n);
for (int &val : a) {
cin >> val;
}
int q;
cin >> q;
while(q--){
int st;
cin >> st;
int l = 0;
int curr = 0;
int ct = 0;
int maxi = 0;
for(int r = 0; r < n; ++r){
curr += a[r];
if(s[r] == 'E') ct++;
while(curr > st){
curr -= a[l];
if(s[l] == 'E') ct--;
l++;
}
maxi = max(maxi, ct);
}
cout << maxi << endl;
}
}
int32_t main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
int t = 1;
// cin>>t;
int x = 1;
while(t--){
debug(x);
++x;
solve();
}
return 0;
}
vjudge1