結果

問題 No.973 余興
ユーザー minatominato
提出日時 2020-01-17 22:19:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,476 bytes
コンパイル時間 2,067 ms
コンパイル使用メモリ 181,760 KB
実行使用メモリ 6,832 KB
最終ジャッジ日時 2023-09-08 03:56:32
合計ジャッジ時間 41,534 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 1,631 ms
6,488 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 1,628 ms
6,488 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1,623 ms
6,556 KB
testcase_10 AC 1,559 ms
6,536 KB
testcase_11 AC 472 ms
4,384 KB
testcase_12 AC 477 ms
4,424 KB
testcase_13 AC 470 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 69 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 41 ms
4,380 KB
testcase_18 AC 54 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 41 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 69 ms
4,380 KB
testcase_23 RE -
testcase_24 AC 54 ms
4,376 KB
testcase_25 AC 24 ms
4,384 KB
testcase_26 AC 41 ms
4,376 KB
testcase_27 AC 79 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 53 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,231 ms
6,424 KB
testcase_35 WA -
testcase_36 AC 1,207 ms
6,556 KB
testcase_37 AC 1,201 ms
6,548 KB
testcase_38 AC 1,231 ms
6,456 KB
testcase_39 WA -
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 RE -
testcase_44 AC 1 ms
4,380 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 545 ms
6,420 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 533 ms
6,484 KB
testcase_52 AC 1,415 ms
6,556 KB
testcase_53 AC 1,389 ms
6,488 KB
testcase_54 AC 1,416 ms
6,536 KB
testcase_55 AC 1,414 ms
6,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,X; cin >> N >> X;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    vector<ll> ls(N+1),rs(N+1);
    rep(i,N) ls[i+1] = ls[i] + A[i];
    for (int i = N; i > 0; i--) rs[i-1] = rs[i] + A[i];
    reverse(all(rs));
    vector<vector<bool>> dp(N, vector<bool>(N));
    for (int k = 1; k < N; k++) {
        for (int i = 0; i+k < N; i++) {
            int p = upper_bound(all(ls),X+ls[i]) - ls.begin();
            if (p > i+k+1) dp[i][i+k] = true;
            if (!dp[p-1][i+k]) dp[i][i+k] = true;
            int q = upper_bound(all(rs),X+rs[N-i-k-1]) - rs.begin();
            if (q > N-i) dp[i][i+k] = true;
            if (!dp[i][N-q]) dp[i][i+k] = true;
        }
    }

    cout << (dp[0][N-1] ? "A" : "B") << endl;
}
0