結果
問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
ユーザー |
|
提出日時 | 2020-05-05 17:55:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 478 bytes |
コンパイル時間 | 1,997 ms |
コンパイル使用メモリ | 194,320 KB |
最終ジャッジ日時 | 2025-01-10 06:55:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 58 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; int main(){ int n; string s; cin>>n>>s; vector<lint> a(n); rep(i,n) cin>>a[i]; int q; cin>>q; rep(_,q){ int pw; cin>>pw; int ans=0,cnt=0,r=0; lint sum=0; rep(l,n){ while(r<n && sum+a[r]<=pw){ sum+=a[r]; if(s[r]=='E') cnt++; r++; } ans=max(ans,cnt); sum-=a[l]; if(s[l]=='E') cnt--; } printf("%d\n",ans); } return 0; }