結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー kappybarkappybar
提出日時 2020-03-27 19:25:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,516 bytes
コンパイル時間 1,770 ms
コンパイル使用メモリ 177,904 KB
実行使用メモリ 111,032 KB
最終ジャッジ日時 2023-08-30 16:45:03
合計ジャッジ時間 10,622 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 TLE -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 250 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 6 ms
4,380 KB
testcase_25 AC 6 ms
4,376 KB
testcase_26 AC 6 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 4 ms
4,376 KB
testcase_29 AC 4 ms
4,380 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 AC 4 ms
4,384 KB
testcase_32 AC 6 ms
4,376 KB
testcase_33 TLE -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 TLE -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 TLE -
testcase_43 WA -
testcase_44 WA -
testcase_45 TLE -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 TLE -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
 
int main() {
        int n;
        cin >>  n;
        string s;
        cin >> s;
        vector<int> mon(n+1);
        vector<int> a(n+1);
        rep(i,n) cin >> a[i+1];
        rep(i,n) a[i+1] += a[i];
        rep(i,n){
                if(s[i] == 'E') mon[i+1] ++;
        }
        rep(i,n) mon[i+1] += mon[i];

        map<int,int> mp;
        for(int i=0;i<=n;i++){
                for(int j=i+1;j<=n;j++){
                        int key = a[j] - a[i];
                        int value = mon[j] - mon[i];
                        mp[key] = max(mp[key],value);
                }
        }

        int before = -1;
        for(auto it = mp.begin();it !=mp.end();it++){
                if(it->second < before) it->second = before; 
                else before = it->second;
        }
        
        vector<pp> num = {pp(0,0)};
        for(auto p:mp){
                num.push_back(pp(p.first,p.second));
        }

        int q;
        cin >> q;
        rep(i,q){
                int k;
                cin >> k;
                int l = -1,r = num.size();
                while(r - l > 1){
                        int m = (l + r)/2;
                        if(num[m].first <= k) l = m;
                        else r = m;
                }
                cout << num[l].second << endl;
        }




        return 0;
}


0