結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-20 11:02:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 787 bytes |
| 記録 | |
| コンパイル時間 | 1,239 ms |
| コンパイル使用メモリ | 99,856 KB |
| 最終ジャッジ日時 | 2025-01-11 08:34:38 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <deque>
#include <queue>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
string s; cin >> s;
vector<ll> a(n),sum(n+1);
vector<int> e(n+1);
for(int i=0;i<n;i++){
cin >> a[i];
sum[i+1]=sum[i]+a[i];
e[i+1]=e[i]+(s[i]=='E');
}
int q; cin >> q;
int res;
while(q--){
res=0;
ll k; cin >> k;
for(int i=0;i<=n;i++){
int r=upper_bound(sum.begin()+i,sum.end(),sum[i]+k)-sum.begin();
res=max(res,e[r-1]-e[i]);
}
printf("%d\n",res);
}
}