結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー |
![]() |
提出日時 | 2019-11-29 22:02:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 1,587 ms |
コンパイル使用メモリ | 169,252 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 05:42:56 |
合計ジャッジ時間 | 3,906 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 58 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000 int main(){ int N; cin>>N; string S; cin>>S; vector<long long> A(N); for(int i=0;i<N;i++){ cin>>A[i]; } int Q; cin>>Q; while(Q!=0){ Q--; long long K; cin>>K; int l = 0; int r = 0; int e_cnt = 0; long long sum = 0; int ans = 0; while(true){ if(r==N)break; while(sum+A[r]>K){ sum-=A[l]; if(S[l]=='E')e_cnt--; l++; } sum += A[r]; if(S[r]=='E')e_cnt++; r++; ans = max(ans,e_cnt); } cout<<ans<<endl; } return 0; }