結果
問題 | No.973 余興 |
ユーザー | kotamanegi |
提出日時 | 2020-01-17 22:40:54 |
言語 | C++17(clang) (17.0.6 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,143 bytes |
コンパイル時間 | 3,378 ms |
コンパイル使用メモリ | 134,772 KB |
実行使用メモリ | 224,960 KB |
最終ジャッジ日時 | 2023-08-20 13:44:50 |
合計ジャッジ時間 | 32,991 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 512 ms
223,420 KB |
testcase_06 | AC | 511 ms
224,564 KB |
testcase_07 | AC | 512 ms
223,332 KB |
testcase_08 | AC | 522 ms
223,008 KB |
testcase_09 | AC | 511 ms
223,176 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 348 ms
213,468 KB |
testcase_14 | WA | - |
testcase_15 | AC | 108 ms
203,560 KB |
testcase_16 | AC | 111 ms
203,756 KB |
testcase_17 | WA | - |
testcase_18 | AC | 106 ms
202,904 KB |
testcase_19 | AC | 106 ms
203,260 KB |
testcase_20 | AC | 104 ms
203,556 KB |
testcase_21 | AC | 112 ms
203,824 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 106 ms
203,376 KB |
testcase_29 | WA | - |
testcase_30 | AC | 859 ms
223,700 KB |
testcase_31 | AC | 848 ms
224,204 KB |
testcase_32 | AC | 878 ms
223,692 KB |
testcase_33 | AC | 871 ms
224,604 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | AC | 832 ms
223,704 KB |
testcase_37 | AC | 838 ms
224,268 KB |
testcase_38 | WA | - |
testcase_39 | AC | 863 ms
223,456 KB |
testcase_40 | AC | 86 ms
200,328 KB |
testcase_41 | AC | 87 ms
199,016 KB |
testcase_42 | AC | 91 ms
199,004 KB |
testcase_43 | AC | 88 ms
199,328 KB |
testcase_44 | WA | - |
testcase_45 | AC | 91 ms
199,316 KB |
testcase_46 | WA | - |
testcase_47 | AC | 925 ms
223,568 KB |
testcase_48 | WA | - |
testcase_49 | AC | 849 ms
223,540 KB |
testcase_50 | WA | - |
testcase_51 | AC | 925 ms
223,600 KB |
testcase_52 | AC | 707 ms
223,748 KB |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
コンパイルメッセージ
main.cpp:1:18: warning: '#pragma comment linker' ignored [-Wignored-pragmas] #pragma comment (linker, "/STACK:256000000") ^ 1 warning generated.
ソースコード
#pragma comment (linker, "/STACK:256000000") #define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" using namespace std; typedef string::const_iterator State; #define eps 1e-11L #define MAX_MOD 1000000007LL #define GYAKU 500000004LL #define MOD 998244353LL #define seg_size 262144 #define pb push_back #define mp make_pair typedef long long ll; #define REP(a,b) for(long long (a) = 0;(a) < (b);++(a)) #define ALL(x) (x).begin(),(x).end() void init() { iostream::sync_with_stdio(false); cout << fixed << setprecision(100); } bool ans[5000][5000] = {}; bool visited[5000][5000] = {}; int next_go[2][5000 * 5000] = {}; int union_find(int now, bool dir) { if (next_go[dir][now] == now) return now; return next_go[dir][now] = union_find(next_go[dir][now], dir); } pair<int, int> to_pair(int now) { return mp(now / 5000, now % 5000); } int to_int(pair<int,int> now) { return now.first * 5000 + now.second; } ll summing[7000] = {}; ll calc_sum(int a, int b) { return summing[b+1] - summing[a]; } void solve() { ll n, x; cin >> n >> x; vector<ll> inputs; REP(i, n) { int a; cin >> a; inputs.pb(a); } for (int i = 0; i < inputs.size(); ++i) { summing[i + 1] += inputs[i] + summing[i]; } for (int i = inputs.size(); i + 1 < 7000; ++i) { summing[i + 1] = summing[i]; } REP(i, 5000) { REP(q, 5000) { next_go[0][i*5000+q] = next_go[1][i*5000+q] = i*5000+q; } } for (int i = 0; i < n; ++i) { for (int q = i; q >= 0; --q) { if (ans[i][q] == 1) continue; { //dir = 0 while (true) { int next = union_find(i * 5000 + q, 0); if (next/5000 == 0) break; if (calc_sum(next/5000 - 1, i - 1) > x) break; ans[next/5000 - 1][q] = 1; next_go[0][next] = next - 5000; } } { //dir = 1 while (true) { int next = union_find(i * 5000 + q, 1); if (next % 5000 == n-1) break; if (calc_sum(q+1, next % 5000 + 1) > x) break; ans[next / 5000][next % 5000 + 1] = 1; next_go[1][next] = next + 1; } } } } if (ans[0][n - 1] == 0) { cout << "B" << endl; } else { cout << "A" << endl; } return; } #undef int int main() { init(); solve(); }