結果
| 問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
| コンテスト | |
| ユーザー |
Knots
|
| 提出日時 | 2020-11-27 09:17:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,038 bytes |
| コンパイル時間 | 2,191 ms |
| コンパイル使用メモリ | 193,952 KB |
| 最終ジャッジ日時 | 2025-01-16 05:59:57 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 57 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"
#define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n";
int main(){
int n,q;cin >> n;
string s;cin >> s;
vector<int> a(n);
REP(i,n) cin >> a[i];
cin >> q;
vector<int> k(q);
REP(i,q) cin >> k[i];
for(int i=0;i<q;i++){
int ans = 0;
for(int left=0;left<n;left++){
ll attack = 0;
int tes = 0;
int right = left;
while(right<n&&attack+a[right]<=k[i]){
attack += a[right];
if(s[right]=='E')tes++;
right++;
}
ans = max(ans,tes);
}
COUT(ans);
}
}
Knots