結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
コンテスト
ユーザー vjudge1
提出日時 2026-01-03 18:16:21
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 1,347 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,081 ms
コンパイル使用メモリ 214,876 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-03 18:16:26
合計ジャッジ時間 4,269 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 54
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#ifdef ONPC
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define popcount __builtin_popcountll
#define forn(i,a,b) for (int i = a; i < b; i++)

void solve(){
    // cout<<"runs\n";
    int n;cin>>n;
    vi pref(n+1);
    vi pref2(n+1);
    string s;cin>>s;
    forn(i,1,n+1){
        pref[i]=pref[i-1];
        if(s[i-1]=='E')pref[i]++;
    }
    vi end(n);
    forn(i,1,n+1){ 
        cin>>end[i-1];
        pref2[i]=pref2[i-1]+end[i-1];
    }
    // cout<<n<<"\n";
    // cout<<s<<"\n";
    // forn(i,0,n+1){
    //     cout<<pref[i]<<" ";
    // }
    // cout<<"\n";
    // forn(i,0,n+1){
    //     cout<<pref2[i]<<" ";
    // }

    int q;cin>>q;
    forn(i,0,q){
        int x;cin>>x;
        auto it=upper_bound(pref2.begin(),pref2.end(),x);
        int y=it-pref2.begin()-1;
        // cout<<y<<" ";
        cout<<pref[y]<<"\n";
    }
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    // cin >> t;
    forn(i,0,t){
        solve();
    }
    #ifdef ONPC
    cerr << endl
         << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}
0