結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 585 ms
100,960 KB
testcase_02 AC 567 ms
101,156 KB
testcase_03 WA -
testcase_04 AC 569 ms
100,992 KB
testcase_05 WA -
testcase_06 AC 582 ms
101,212 KB
testcase_07 WA -
testcase_08 AC 564 ms
100,424 KB
testcase_09 AC 580 ms
101,008 KB
testcase_10 AC 559 ms
97,048 KB
testcase_11 AC 97 ms
38,476 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 95 ms
38,096 KB
testcase_15 AC 15 ms
7,336 KB
testcase_16 AC 14 ms
7,576 KB
testcase_17 WA -
testcase_18 AC 12 ms
6,572 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 17 ms
7,352 KB
testcase_22 AC 16 ms
7,340 KB
testcase_23 AC 12 ms
6,776 KB
testcase_24 AC 13 ms
6,500 KB
testcase_25 AC 7 ms
4,764 KB
testcase_26 AC 10 ms
5,752 KB
testcase_27 WA -
testcase_28 AC 12 ms
6,584 KB
testcase_29 AC 13 ms
6,536 KB
testcase_30 AC 358 ms
100,960 KB
testcase_31 AC 360 ms
100,996 KB
testcase_32 AC 364 ms
101,072 KB
testcase_33 AC 363 ms
100,720 KB
testcase_34 AC 353 ms
100,572 KB
testcase_35 AC 362 ms
101,196 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 359 ms
100,932 KB
testcase_39 WA -
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 WA -
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 2 ms
4,376 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 359 ms
100,912 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 363 ms
101,032 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
    REP(i, N) cin >> a[i];
    vector<vector<int>> win(N,vector<int>(N,X+1));
    REP(i,N) win[i][i]=X+1;
    rep(k,1,N) REP(i,N){
        if(i-k>=0){
            int res=win[i-k+1][i]+a[i-k];
            if(res-a[i-k]==X+1) chmin(win[i-k][i],a[i-k]);
            else if(res<=X) chmin(win[i-k][i],res);
        }
        if(i+k<N){
            int res=win[i][i+k-1]+a[i+k];
            if(res-a[i+k]==X+1) chmin(win[i][i+k],a[i-k]);
            else if(res<=X) chmin(win[i][i+k],res);
        }
    }
    if(win[0][N-1]==X+1) cout<<"B"<<endl;
    else cout<<"A"<<endl;
}
0