結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー rhincodon66rhincodon66
提出日時 2019-11-29 23:12:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 1,062 bytes
コンパイル時間 1,573 ms
コンパイル使用メモリ 170,656 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 06:32:54
合計ジャッジ時間 6,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,348 KB
testcase_01 AC 28 ms
4,352 KB
testcase_02 AC 3 ms
4,352 KB
testcase_03 AC 33 ms
4,348 KB
testcase_04 AC 40 ms
4,348 KB
testcase_05 AC 6 ms
4,352 KB
testcase_06 AC 73 ms
4,352 KB
testcase_07 AC 69 ms
4,352 KB
testcase_08 AC 172 ms
4,348 KB
testcase_09 AC 103 ms
4,352 KB
testcase_10 AC 123 ms
4,348 KB
testcase_11 AC 156 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 214 ms
4,352 KB
testcase_18 AC 35 ms
4,348 KB
testcase_19 AC 87 ms
4,348 KB
testcase_20 AC 67 ms
4,348 KB
testcase_21 AC 9 ms
4,348 KB
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,352 KB
testcase_25 AC 2 ms
4,352 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 2 ms
4,352 KB
testcase_29 AC 3 ms
4,352 KB
testcase_30 AC 2 ms
4,352 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 73 ms
4,352 KB
testcase_34 AC 130 ms
4,352 KB
testcase_35 AC 116 ms
4,352 KB
testcase_36 AC 26 ms
4,348 KB
testcase_37 AC 73 ms
4,348 KB
testcase_38 AC 71 ms
4,348 KB
testcase_39 AC 139 ms
4,352 KB
testcase_40 AC 152 ms
4,348 KB
testcase_41 AC 150 ms
4,348 KB
testcase_42 AC 113 ms
4,352 KB
testcase_43 AC 156 ms
4,348 KB
testcase_44 AC 46 ms
4,352 KB
testcase_45 AC 155 ms
4,348 KB
testcase_46 AC 15 ms
4,352 KB
testcase_47 AC 57 ms
4,348 KB
testcase_48 AC 44 ms
4,352 KB
testcase_49 AC 51 ms
4,348 KB
testcase_50 AC 65 ms
4,348 KB
testcase_51 AC 80 ms
4,348 KB
testcase_52 AC 76 ms
4,348 KB
testcase_53 AC 135 ms
4,348 KB
testcase_54 AC 27 ms
4,352 KB
testcase_55 AC 5 ms
4,352 KB
testcase_56 AC 103 ms
4,348 KB
testcase_57 AC 64 ms
4,352 KB
testcase_58 AC 1 ms
4,348 KB
testcase_59 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> e(n + 1);
	string s;cin >> s;
	rep(i,n){
		if(s.at(i) == 'E') e.at(i)++;
	}
	for(int i = n - 1; i >= 0; i--) e.at(i) += e.at(i + 1);
	vector<ll> a(n + 1);
	rep(i,n) cin >> a.at(i);
	for(int i = n - 2; i >= 0; i--) a.at(i) += a.at(i + 1);
	int q;cin >> q;
	while(q--){
		ll k;cin >> k;
		int ans = 0;
		rep(i,n){
			int ok = i - 1, ng = n;
			while(abs(ok - ng) > 1){
				int mid = (ok + ng) / 2;
				if(a.at(i) - a.at(mid + 1) <= k) ok = mid;
				else ng = mid;
			}
			if(ok >= i) ans = max(ans, e.at(i) - e.at(ok + 1));
		}
		cout << ans << endl;
	}
}
0