結果

問題 No.973 余興
ユーザー pekempeypekempey
提出日時 2020-01-17 21:55:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 676 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 169,216 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-08 02:41:42
合計ジャッジ時間 3,477 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 4 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 4 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 4 ms
4,376 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 3 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 4 ms
4,376 KB
testcase_36 AC 3 ms
4,376 KB
testcase_37 AC 3 ms
4,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 2 ms
4,504 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 1 ms
4,380 KB
testcase_44 WA -
testcase_45 AC 2 ms
4,376 KB
testcase_46 AC 3 ms
4,384 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 3 ms
4,380 KB
testcase_50 AC 3 ms
4,380 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 3 ms
4,376 KB
testcase_55 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  int N; cin >> N;
  ll X; cin >> X;
  vector<ll> A(N); rep(i, N) cin >> A[i];
  vector<ll> S(N + 1); rep(i, N) S[i + 1] = S[i] + A[i];
  vector<int> dp(N + 1);
  vector<int> dps(N + 2);
  dp[N] = 1;
  dps[N] = 1;
  repr(i, N) {
    // S[j] > X + S[i]
    int j = upper_bound(range(S), X + S[i]) - S.begin();
    if (dps[i + 1] - dps[j] != j - (i + 1)) {
      dp[i] = 1;
    }
    dps[i] = dps[i + 1] + dp[i];
  }
  cout << (dp[0] ? "A" : "B") << endl;
}
0