結果

問題 No.973 余興
ユーザー 0w10w1
提出日時 2020-01-23 02:04:52
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,183 bytes
コンパイル時間 2,157 ms
コンパイル使用メモリ 206,152 KB
実行使用メモリ 199,180 KB
最終ジャッジ日時 2023-09-25 03:23:54
合計ジャッジ時間 59,779 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,485 ms
198,996 KB
testcase_01 AC 1,467 ms
198,904 KB
testcase_02 AC 1,432 ms
198,572 KB
testcase_03 AC 1,460 ms
198,728 KB
testcase_04 AC 1,456 ms
199,020 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1,385 ms
191,084 KB
testcase_11 AC 507 ms
73,532 KB
testcase_12 AC 528 ms
73,604 KB
testcase_13 WA -
testcase_14 AC 524 ms
73,004 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 22 ms
8,164 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 37 ms
11,028 KB
testcase_23 AC 29 ms
9,440 KB
testcase_24 AC 29 ms
9,428 KB
testcase_25 AC 13 ms
5,948 KB
testcase_26 AC 22 ms
7,776 KB
testcase_27 AC 43 ms
12,312 KB
testcase_28 WA -
testcase_29 AC 28 ms
9,364 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,677 ms
197,776 KB
testcase_35 AC 1,767 ms
198,844 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 1,762 ms
198,108 KB
testcase_39 WA -
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,384 KB
testcase_43 WA -
testcase_44 AC 1 ms
4,376 KB
testcase_45 WA -
testcase_46 AC 1,729 ms
198,976 KB
testcase_47 WA -
testcase_48 AC 1,727 ms
198,836 KB
testcase_49 WA -
testcase_50 AC 1,721 ms
197,268 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 1,750 ms
195,508 KB
testcase_54 AC 1,761 ms
198,940 KB
testcase_55 AC 1,731 ms
199,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int N, X;
  cin >> N >> X;

  vector<int> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];

  vector<int64_t> pa(N + 1);
  for (int i = 0; i < N; ++i) pa[i + 1] = pa[i] + A[i];

  vector<vector<int>> pdp(N, vector<int>(N + 1));
  vector<vector<int>> sdp(N, vector<int>(N + 1));
  for (int len = 2; len <= N; ++len) {
    for (int i = 0; i + len <= N; ++i) {
      int win = 0; {
        int lb = 1;
        int ub = len + 1;
        while (ub - lb > 1) {
          int mb = lb + ub >> 1;
          (pa[i + mb] - pa[i] <= X ? lb : ub) = mb;
        }
        win |= sdp[i + len - 1][len - 1] - sdp[i + len - 1][len - lb] < lb;
      } {
        int lb = 1;
        int ub = len + 1;
        while (ub - lb > 1) {
          int mb = lb + ub >> 1;
          (pa[i + len] - pa[i + len - mb] <= X ? lb : ub) = mb;
        }
        win |= pdp[i][len - 1] - pdp[i][len - lb] < lb;
      }
      pdp[i][len] = pdp[i][len - 1] + win;
      sdp[i + len - 1][len] = sdp[i + len - 1][len - 1] + win;
    }
  }

  int fwin = pdp[0][N] - pdp[0][N - 1];
  cout << "AB"[fwin ^ 1] << endl;

  return 0;
}
0