結果
問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
ユーザー |
![]() |
提出日時 | 2019-11-29 23:20:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 1,266 ms |
コンパイル使用メモリ | 159,356 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 05:54:04 |
合計ジャッジ時間 | 4,233 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 58 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(vec) vec.begin(),vec.end() #define MOD 1000000007 #define int long long signed main(){ string s; int n;cin>>n>>s; int a[n+1]; int w[n+1]; w[0]=0; rep(i,n){ w[i+1]=w[i]+(s[i]=='E'); } a[0]=0; rep(i,n){ int r;cin>>r; a[i+1]=a[i]+r; } int q;cin>>q; rep(i,q){ int k; cin>>k; int ans=0; rep(ii,n){ auto j=upper_bound(a+ii,a+n+1,k+a[ii]); int it=j-a-1; ans=max(ans,w[it]-w[ii]); } cout<<ans<<endl; } }