結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー shop_one
提出日時 2019-11-29 21:55:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 68,752 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-20 22:03:49
合計ジャッジ時間 2,315 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,q,a,ans,k;
  string s;
  cin >> n >> s;
  vector<ll> cnt(n+1),sum(n+1);
  cnt[0] = sum[0] = 0;
  for(int i=0;i<n;i++){
    cin >> a;
    sum[i+1]=a;
    if(s[i]=='E') cnt[i+1]++;
    sum[i+1]+=sum[i];
    cnt[i+1]+=cnt[i];
  }
  cin >> q;
  for(int i=0;i<q;i++){
    cin >> k;
    auto it = upper_bound(sum.begin(),sum.end(),k);
    size_t idx = distance(sum.begin(),it);
    cout << cnt[idx-1]<<endl;
  }
}
0