結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー NOSS
提出日時 2019-11-29 22:26:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 73,924 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-20 23:35:33
合計ジャッジ時間 2,188 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

using ll = long long int;
using P = pair<ll,ll>;
constexpr ll INF = 1LL<<50;

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<ll> a(n+1), cnt(n+1);
    for(int i=0;i<n;i++){
        cin >> a[i+1];
        a[i+1] += a[i];
        if(s[i] == 'E') cnt[i+1]++;
        cnt[i+1] += cnt[i];
    }
    int q;
    cin >> q;
    for(int i=0;i<q;i++){
        ll k;
        cin >> k;
        int l = upper_bound(a.begin(), a.end(), k) - a.begin();
        cout << cnt[l-1] << endl;
    }
    return 0;
}
0