結果
問題 | No.973 余興 |
ユーザー | はまやんはまやん |
提出日時 | 2020-01-18 12:01:28 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,014 bytes |
コンパイル時間 | 2,193 ms |
コンパイル使用メモリ | 201,980 KB |
実行使用メモリ | 137,344 KB |
最終ジャッジ日時 | 2024-06-27 05:21:02 |
合計ジャッジ時間 | 25,950 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 618 ms
137,216 KB |
testcase_01 | AC | 614 ms
137,088 KB |
testcase_02 | AC | 610 ms
137,088 KB |
testcase_03 | AC | 620 ms
136,960 KB |
testcase_04 | AC | 618 ms
137,216 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 587 ms
133,120 KB |
testcase_11 | AC | 239 ms
62,720 KB |
testcase_12 | AC | 241 ms
62,592 KB |
testcase_13 | WA | - |
testcase_14 | AC | 234 ms
62,208 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 13 ms
12,160 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 21 ms
15,360 KB |
testcase_23 | AC | 17 ms
13,696 KB |
testcase_24 | AC | 16 ms
13,696 KB |
testcase_25 | AC | 9 ms
9,600 KB |
testcase_26 | AC | 11 ms
11,904 KB |
testcase_27 | AC | 26 ms
16,640 KB |
testcase_28 | WA | - |
testcase_29 | AC | 16 ms
13,568 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 700 ms
136,704 KB |
testcase_35 | AC | 705 ms
137,088 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | AC | 697 ms
136,832 KB |
testcase_39 | WA | - |
testcase_40 | AC | 2 ms
5,376 KB |
testcase_41 | AC | 2 ms
5,376 KB |
testcase_42 | AC | 2 ms
5,376 KB |
testcase_43 | WA | - |
testcase_44 | AC | 2 ms
5,376 KB |
testcase_45 | WA | - |
testcase_46 | AC | 657 ms
137,216 KB |
testcase_47 | WA | - |
testcase_48 | AC | 665 ms
137,216 KB |
testcase_49 | WA | - |
testcase_50 | AC | 654 ms
136,448 KB |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | AC | 712 ms
135,296 KB |
testcase_54 | AC | 727 ms
137,088 KB |
testcase_55 | AC | 730 ms
137,216 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; }