結果

問題 No.973 余興
ユーザー otamay6otamay6
提出日時 2020-01-19 12:50:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,049 bytes
コンパイル時間 2,783 ms
コンパイル使用メモリ 170,928 KB
実行使用メモリ 101,036 KB
最終ジャッジ日時 2023-09-15 20:00:41
合計ジャッジ時間 19,205 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 631 ms
100,972 KB
testcase_01 AC 631 ms
100,936 KB
testcase_02 AC 623 ms
101,012 KB
testcase_03 AC 628 ms
101,032 KB
testcase_04 AC 631 ms
100,872 KB
testcase_05 AC 628 ms
100,868 KB
testcase_06 AC 631 ms
101,036 KB
testcase_07 AC 630 ms
100,984 KB
testcase_08 AC 626 ms
100,748 KB
testcase_09 AC 631 ms
100,924 KB
testcase_10 AC 602 ms
97,072 KB
testcase_11 AC 107 ms
38,436 KB
testcase_12 AC 108 ms
38,444 KB
testcase_13 AC 106 ms
38,092 KB
testcase_14 AC 106 ms
38,192 KB
testcase_15 AC 19 ms
7,304 KB
testcase_16 AC 20 ms
7,344 KB
testcase_17 AC 12 ms
5,812 KB
testcase_18 AC 15 ms
6,552 KB
testcase_19 AC 16 ms
6,536 KB
testcase_20 WA -
testcase_21 AC 19 ms
7,260 KB
testcase_22 AC 19 ms
7,248 KB
testcase_23 AC 15 ms
6,580 KB
testcase_24 WA -
testcase_25 AC 7 ms
4,800 KB
testcase_26 AC 12 ms
5,832 KB
testcase_27 AC 22 ms
7,416 KB
testcase_28 AC 15 ms
6,644 KB
testcase_29 AC 15 ms
6,468 KB
testcase_30 AC 378 ms
100,932 KB
testcase_31 AC 377 ms
100,936 KB
testcase_32 AC 378 ms
100,980 KB
testcase_33 AC 374 ms
100,976 KB
testcase_34 AC 375 ms
100,348 KB
testcase_35 AC 373 ms
100,936 KB
testcase_36 AC 363 ms
98,336 KB
testcase_37 AC 362 ms
98,364 KB
testcase_38 AC 380 ms
100,700 KB
testcase_39 AC 378 ms
100,768 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 1 ms
4,376 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 AC 376 ms
100,972 KB
testcase_47 AC 377 ms
101,008 KB
testcase_48 AC 375 ms
100,976 KB
testcase_49 AC 342 ms
93,320 KB
testcase_50 AC 377 ms
100,136 KB
testcase_51 AC 374 ms
101,028 KB
testcase_52 AC 376 ms
101,012 KB
testcase_53 AC 365 ms
99,128 KB
testcase_54 AC 374 ms
101,004 KB
testcase_55 AC 376 ms
101,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;
 template<typename T>
    bool chmin(T &a,T b){
        if(b<a){
            a=b;
            return true;
        }
        return false;
    }
int main(){
    int N,X;cin>>N>>X;
    vector<int> a(N+1);
    REP(i, N) cin >> a[i];
    vector<vector<int>> win(N+1,vector<int>(N+1,X+1));
    REP(i,N) win[i][i+1]=X+1;
    rep(k,1,N+1) REP(i,N){
        if(i-k>=0){
            int res=win[i-k+1][i+1]+a[i-k];
            if(win[i-k+1][i+1]==X+1) chmin(win[i-k][i+1],a[i-k]);
            else if(res<=X) chmin(win[i-k][i+1],res);
        }
        if(i+k<N){
            int res=win[i][i+k]+a[i+k];
            if(win[i][i+k]==X+1) chmin(win[i][i+k+1],a[i+k]);
            else if(res<=X) chmin(win[i][i+k+1],res);
        }
    }
    if(win[0][N]==X+1) cout<<"B"<<endl;
    else cout<<"A"<<endl;
}
0