結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー |
![]() |
提出日時 | 2019-11-30 00:02:40 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 669 bytes |
コンパイル時間 | 1,917 ms |
コンパイル使用メモリ | 159,052 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 23:55:17 |
合計ジャッジ時間 | 6,067 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 54 WA * 3 TLE * 1 |
ソースコード
#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){ int j=ii; while(a[j]<=k+a[ii]&&j<n)j++; int it=j-1; ans=max(ans,w[it]-w[ii]); } cout<<ans<<endl; } }