結果
問題 | No.973 余興 |
ユーザー | nebukuro09 |
提出日時 | 2020-01-17 22:46:31 |
言語 | D (dmd 2.107.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,481 bytes |
コンパイル時間 | 1,873 ms |
コンパイル使用メモリ | 103,164 KB |
実行使用メモリ | 44,668 KB |
最終ジャッジ日時 | 2023-09-04 04:48:28 |
合計ジャッジ時間 | 44,127 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,123 ms
43,192 KB |
testcase_01 | WA | - |
testcase_02 | AC | 1,122 ms
43,360 KB |
testcase_03 | AC | 1,124 ms
43,508 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 1,131 ms
44,164 KB |
testcase_07 | WA | - |
testcase_08 | AC | 1,121 ms
44,116 KB |
testcase_09 | AC | 1,130 ms
44,464 KB |
testcase_10 | AC | 1,084 ms
42,640 KB |
testcase_11 | WA | - |
testcase_12 | AC | 465 ms
14,996 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 40 ms
4,380 KB |
testcase_16 | AC | 40 ms
4,376 KB |
testcase_17 | AC | 24 ms
4,380 KB |
testcase_18 | AC | 32 ms
4,376 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 40 ms
4,376 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 46 ms
4,380 KB |
testcase_28 | AC | 31 ms
4,380 KB |
testcase_29 | WA | - |
testcase_30 | AC | 1,276 ms
43,716 KB |
testcase_31 | AC | 1,277 ms
43,472 KB |
testcase_32 | AC | 1,274 ms
43,756 KB |
testcase_33 | AC | 1,273 ms
44,380 KB |
testcase_34 | AC | 1,266 ms
44,668 KB |
testcase_35 | WA | - |
testcase_36 | AC | 1,233 ms
44,176 KB |
testcase_37 | AC | 1,241 ms
44,448 KB |
testcase_38 | AC | 1,271 ms
43,776 KB |
testcase_39 | WA | - |
testcase_40 | AC | 1 ms
4,380 KB |
testcase_41 | AC | 1 ms
4,376 KB |
testcase_42 | AC | 2 ms
4,380 KB |
testcase_43 | AC | 1 ms
4,380 KB |
testcase_44 | AC | 2 ms
4,376 KB |
testcase_45 | AC | 2 ms
4,380 KB |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 1,033 ms
43,452 KB |
testcase_49 | AC | 951 ms
42,644 KB |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | AC | 1,440 ms
43,412 KB |
testcase_54 | WA | - |
testcase_55 | WA | - |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto X = s[1].to!long; auto A = readln.split.map!(to!long).array; auto B = new long[](N+1); foreach (i; 0..N) B[i+1] = B[i] + A[i]; long sum(int l, int r) { if (r < l) return 0; return B[r+1] - B[l]; } int calc_left(int l, int r) { int hi = r + 1; int lo = l; while (hi - lo > 1) { int mid = (hi + lo) / 2; if (sum(l, mid) <= X) lo = mid; else hi = mid; } return lo; } int calc_right(int l, int r) { int hi = r; int lo = l - 1; while (hi - lo > 1) { int mid = (hi + lo) / 2; if (sum(mid, r) <= X) hi = mid; else lo = mid; } return hi; } auto ans = new bool[][](N, N); auto minr = new int[](N); auto maxl = new int[](N); foreach (i; 0..N) minr[i] = maxl[i] = i; foreach (l; 0..N) foreach (r; l+1..N) { int nr = calc_right(l, r) - 1; int nl = calc_left(l, r) + 1; if (nr <= minr[l] || nl >= maxl[r]) { ans[l][r] = true; } else { minr[l] = r; maxl[r] = l; } } writeln(ans[0][N-1] ? "A" : "B"); }