結果
問題 | No.973 余興 |
ユーザー | 👑 はまやんはまやん |
提出日時 | 2020-01-18 12:11:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,087 bytes |
コンパイル時間 | 2,144 ms |
コンパイル使用メモリ | 200,912 KB |
実行使用メモリ | 196,968 KB |
最終ジャッジ日時 | 2023-09-09 12:28:51 |
合計ジャッジ時間 | 20,824 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 419 ms
196,712 KB |
testcase_01 | AC | 424 ms
196,700 KB |
testcase_02 | AC | 422 ms
196,820 KB |
testcase_03 | AC | 426 ms
196,712 KB |
testcase_04 | AC | 431 ms
196,772 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 407 ms
196,668 KB |
testcase_11 | AC | 186 ms
122,712 KB |
testcase_12 | AC | 181 ms
122,712 KB |
testcase_13 | WA | - |
testcase_14 | AC | 179 ms
122,708 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 14 ms
36,580 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 19 ms
44,792 KB |
testcase_23 | AC | 16 ms
40,864 KB |
testcase_24 | AC | 17 ms
40,692 KB |
testcase_25 | AC | 10 ms
28,676 KB |
testcase_26 | AC | 13 ms
36,860 KB |
testcase_27 | AC | 22 ms
48,940 KB |
testcase_28 | WA | - |
testcase_29 | AC | 16 ms
40,752 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 517 ms
196,672 KB |
testcase_35 | AC | 514 ms
196,712 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 516 ms
196,852 KB |
testcase_39 | WA | - |
testcase_40 | AC | 2 ms
5,460 KB |
testcase_41 | AC | 2 ms
4,380 KB |
testcase_42 | AC | 1 ms
4,376 KB |
testcase_43 | WA | - |
testcase_44 | AC | 3 ms
5,508 KB |
testcase_45 | WA | - |
testcase_46 | AC | 494 ms
196,692 KB |
testcase_47 | WA | - |
testcase_48 | AC | 507 ms
196,720 KB |
testcase_49 | WA | - |
testcase_50 | AC | 497 ms
196,628 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | AC | 501 ms
196,644 KB |
testcase_54 | AC | 508 ms
196,700 KB |
testcase_55 | AC | 508 ms
196,700 KB |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() //#pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i @hamayanhamayan0 / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ int N, X, A[5010]; int lft[5010][5010], rht[5010][5010]; //--------------------------------------------------------------------------------------------------- ll B[5010]; // [l,r] ll get(int l, int r) { ll res = B[r]; if (l) res -= B[l - 1]; return res; } //--------------------------------------------------------------------------------------------------- int ng_lft[5010], ng_rht[5010]; void make_ng() { rep(len, 2, N + 1) { int ng = 0; rep(l, 0, N - len + 1) { int r = l + len - 1; while (ng <= l) ng++; while (ng <= r and get(l, ng) <= X) ng++; ng_lft[l] = ng; } ng = N; rrep(r, N - len, len - 1) { int l = r - len + 1; while (r <= ng) ng--; while (l <= ng and get(ng, r) <= X) ng--; ng_rht[r] = ng; } } } //--------------------------------------------------------------------------------------------------- void _main() { cin >> N >> X; rep(i, 0, N) cin >> A[i]; if (N == 1) { cout << "B" << endl; return; } B[0] = A[0]; rep(i, 1, N) B[i] = B[i - 1] + A[i]; make_ng(); rep(i, 0, N) { lft[i][i] = 1; rht[i][i] = 1; } rep(len, 2, N + 1) { rep(l, 0, N - len + 1) { int r = l + len - 1; rht[r][l] = rht[r][l + 1]; lft[l][r] = lft[l][r - 1]; int tot = rht[r][l + 1]; // [l + 1, ng_lft[l] - 1] if (0 <= ng_lft[l] - 2) tot -= rht[r][ng_lft[l] - 2]; int cnt = (ng_lft[l] - 1) - (l + 1) + 1; if (tot != cnt) { rht[r][l]++; lft[l][r]++; continue; } tot = lft[l][r] - lft[l][ng_rht[r]]; // [ng_rht[r] + 1, r] cnt = r - (ng_rht[r] + 1) + 1; if (tot != cnt) { rht[r][l]++; lft[l][r]++; continue; } } } if (lft[0][N - 1] == lft[0][N - 2] + 1) cout << "A" << endl; else cout << "B" << endl; }