結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-01-03 17:49:52 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 896 bytes |
| 記録 | |
| コンパイル時間 | 3,194 ms |
| コンパイル使用メモリ | 336,668 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-01-03 17:49:58 |
| 合計ジャッジ時間 | 5,785 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
// Source: https://usaco.guide/general/io
//who needs macros when you have usaco
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fastnuces ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t = 1;
void solve(){
int n;
cin>>n;
string s;
cin>>s;
vector<int>a(n);
for(int i=0;i<n;++i)cin>>a[i];
int q;
cin>>q;
while(q--){
int k;
cin>>k;
int sm=0,mx=0,l=0,cnt=0;
for(int r=0;r<n;++r){
sm+=a[r];
if(s[r]=='E')cnt++;
while(sm>k){
sm-=a[l];
if(s[l]=='E')cnt--;
l++;
}
//cout<<cnt<<endl;
mx=max(mx,cnt);
}
cout<<mx<<endl;
}
}
signed main(){
fastnuces;
// for(int i=100;i>=1;--i)dfs(i);
//cin>>t;
while(t--){
solve();
}
}
vjudge1