結果
| 問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-29 22:02:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 463 bytes |
| コンパイル時間 | 679 ms |
| コンパイル使用メモリ | 68,056 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 05:42:42 |
| 合計ジャッジ時間 | 2,428 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int N;string S;
long A[2000];
long X[2020];
main()
{
cin>>N>>S;
for(int i=1;i<=N;i++)X[i]=9e18;
for(int i=0;i<N;i++)cin>>A[i];
int Mx=0;
for(int i=0;i<N;i++)
{
long now=0;
int cnt=0;
for(int j=i;j<N;j++)
{
now+=A[j];
cnt+=S[j]=='E';
X[cnt]=min(X[cnt],now);
if(Mx<cnt)Mx=cnt;
}
}
int Q;cin>>Q;
for(;Q--;)
{
long K;cin>>K;
cout<<upper_bound(X,X+Mx+1,K)-X-1<<endl;
}
}