結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 615 ms
100,992 KB
testcase_06 AC 618 ms
101,004 KB
testcase_07 AC 617 ms
100,968 KB
testcase_08 AC 622 ms
100,396 KB
testcase_09 AC 615 ms
101,008 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 100 ms
37,828 KB
testcase_14 WA -
testcase_15 AC 18 ms
7,332 KB
testcase_16 AC 19 ms
7,408 KB
testcase_17 WA -
testcase_18 AC 15 ms
6,548 KB
testcase_19 AC 15 ms
6,556 KB
testcase_20 AC 11 ms
5,828 KB
testcase_21 AC 18 ms
7,312 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 15 ms
6,776 KB
testcase_29 WA -
testcase_30 AC 371 ms
101,024 KB
testcase_31 AC 369 ms
101,016 KB
testcase_32 AC 367 ms
101,204 KB
testcase_33 AC 371 ms
100,924 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 355 ms
98,292 KB
testcase_37 AC 356 ms
98,512 KB
testcase_38 WA -
testcase_39 AC 374 ms
100,724 KB
testcase_40 WA -
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 1 ms
4,380 KB
testcase_44 WA -
testcase_45 AC 2 ms
4,380 KB
testcase_46 WA -
testcase_47 AC 371 ms
100,996 KB
testcase_48 WA -
testcase_49 AC 336 ms
93,332 KB
testcase_50 WA -
testcase_51 AC 372 ms
100,992 KB
testcase_52 AC 373 ms
101,072 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+1,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(win[i-k+1][i]==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(win[i][i+k-1]==X+1) chmin(win[i][i+k],a[i+k]);
            else if(res<=X) chmin(win[i][i+k],res);
        }
    }
    if(win[0][N]==X+1) cout<<"B"<<endl;
    else cout<<"A"<<endl;
}
0