結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 1,508 ms
6,504 KB
testcase_05 AC 1,504 ms
6,488 KB
testcase_06 AC 1,500 ms
6,416 KB
testcase_07 AC 1,496 ms
6,408 KB
testcase_08 WA -
testcase_09 AC 1,496 ms
6,472 KB
testcase_10 WA -
testcase_11 AC 432 ms
4,380 KB
testcase_12 AC 431 ms
4,388 KB
testcase_13 WA -
testcase_14 AC 428 ms
4,564 KB
testcase_15 WA -
testcase_16 AC 66 ms
4,380 KB
testcase_17 AC 38 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 36 ms
4,376 KB
testcase_21 AC 63 ms
4,384 KB
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 37 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 51 ms
4,376 KB
testcase_29 WA -
testcase_30 AC 1,170 ms
6,500 KB
testcase_31 AC 1,168 ms
6,508 KB
testcase_32 AC 1,172 ms
6,492 KB
testcase_33 AC 1,169 ms
6,420 KB
testcase_34 AC 1,149 ms
6,416 KB
testcase_35 AC 1,156 ms
6,468 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 1,147 ms
6,416 KB
testcase_39 WA -
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 RE -
testcase_44 AC 1 ms
4,376 KB
testcase_45 WA -
testcase_46 AC 480 ms
6,404 KB
testcase_47 AC 461 ms
6,416 KB
testcase_48 AC 443 ms
6,396 KB
testcase_49 WA -
testcase_50 AC 475 ms
6,460 KB
testcase_51 AC 457 ms
6,464 KB
testcase_52 AC 1,330 ms
6,416 KB
testcase_53 AC 1,308 ms
6,396 KB
testcase_54 AC 1,330 ms
6,404 KB
testcase_55 WA -
権限があれば一括ダウンロードができます

ソースコード

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) 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+1]) dp[i][i+k] = true;
        }
    }

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