結果
問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
ユーザー |
|
提出日時 | 2019-11-29 22:53:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 792 bytes |
コンパイル時間 | 1,216 ms |
コンパイル使用メモリ | 104,112 KB |
最終ジャッジ日時 | 2025-01-08 06:10:24 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 57 TLE * 1 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <iomanip> #include <cmath> #include <map> using namespace std; using ll = long long; constexpr ll MOD = 1e9 + 7; constexpr int INF = 1 << 30; int N, Q, K; string S; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cin >> N >> S; vector<ll> A(N), SE(N+1), SK(N+1); for(int i = 0; i < N; ++i) cin >> A[i]; for(int i = 0; i < N; ++i) { SE[i+1] = SE[i] + (S[i] == 'E'); SK[i+1] = SK[i] + A[i]; } cin >> Q; for(int i = 0; i < Q; ++i) { cin >> K; ll ans = 0; for(int j = 0; j < N; ++j) { for(int k = j + 1; k <= N; ++k) { if(SK[k] - SK[j] > K) break; ans = max(ans, SE[k] - SE[j]); } } cout << ans << '\n'; } return 0; }