結果
問題 | No.973 余興 |
ユーザー | 👑 はまやんはまやん |
提出日時 | 2020-01-18 12:01:28 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,014 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 200,624 KB |
実行使用メモリ | 158,376 KB |
最終ジャッジ日時 | 2023-09-09 12:16:05 |
合計ジャッジ時間 | 20,684 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 442 ms
158,120 KB |
testcase_01 | AC | 442 ms
158,160 KB |
testcase_02 | AC | 442 ms
158,100 KB |
testcase_03 | AC | 445 ms
158,196 KB |
testcase_04 | AC | 445 ms
158,104 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 424 ms
156,208 KB |
testcase_11 | AC | 183 ms
96,424 KB |
testcase_12 | AC | 183 ms
96,552 KB |
testcase_13 | WA | - |
testcase_14 | AC | 182 ms
96,256 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 13 ms
36,584 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 18 ms
44,836 KB |
testcase_23 | AC | 16 ms
40,684 KB |
testcase_24 | AC | 15 ms
40,680 KB |
testcase_25 | AC | 9 ms
28,444 KB |
testcase_26 | AC | 13 ms
36,648 KB |
testcase_27 | AC | 22 ms
49,024 KB |
testcase_28 | WA | - |
testcase_29 | AC | 15 ms
40,744 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 521 ms
158,116 KB |
testcase_35 | AC | 522 ms
158,156 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 521 ms
158,284 KB |
testcase_39 | WA | - |
testcase_40 | AC | 2 ms
5,600 KB |
testcase_41 | AC | 2 ms
4,380 KB |
testcase_42 | AC | 1 ms
4,380 KB |
testcase_43 | WA | - |
testcase_44 | AC | 2 ms
5,452 KB |
testcase_45 | WA | - |
testcase_46 | AC | 517 ms
158,292 KB |
testcase_47 | WA | - |
testcase_48 | AC | 509 ms
158,108 KB |
testcase_49 | WA | - |
testcase_50 | AC | 506 ms
157,916 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | AC | 510 ms
157,488 KB |
testcase_54 | AC | 523 ms
158,112 KB |
testcase_55 | AC | 519 ms
158,108 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) { int ng = 0; 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][ng_lft[l] - 1] - rht[r][l]; 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]]; 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; }