結果
問題 | No.2860 Heal Slimes |
ユーザー | square1001 |
提出日時 | 2024-07-15 11:30:16 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 976 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 32,944 KB |
最終ジャッジ日時 | 2024-07-15 11:30:39 |
合計ジャッジ時間 | 21,342 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 446 ms
10,752 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 82 ms
11,264 KB |
testcase_11 | AC | 78 ms
11,264 KB |
testcase_12 | AC | 78 ms
11,136 KB |
testcase_13 | AC | 80 ms
11,264 KB |
testcase_14 | AC | 82 ms
11,264 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 135 ms
25,336 KB |
testcase_26 | AC | 96 ms
20,240 KB |
testcase_27 | AC | 172 ms
27,492 KB |
testcase_28 | AC | 171 ms
30,656 KB |
testcase_29 | AC | 143 ms
25,628 KB |
testcase_30 | AC | 184 ms
30,892 KB |
testcase_31 | AC | 184 ms
31,516 KB |
testcase_32 | AC | 184 ms
31,088 KB |
testcase_33 | AC | 180 ms
30,504 KB |
testcase_34 | AC | 181 ms
32,624 KB |
testcase_35 | AC | 181 ms
30,840 KB |
testcase_36 | AC | 190 ms
31,212 KB |
testcase_37 | AC | 183 ms
30,664 KB |
testcase_38 | AC | 179 ms
31,484 KB |
testcase_39 | AC | 186 ms
31,092 KB |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
ソースコード
# divide (a[0] + a[1] * x + ... + a[n-1] * x^(n-1)) by (1 + x + ... + x^(k-1)) def flat_division(n, a, k): b = [0] * (n+1) for i in range(n): b[i] -= a[i] b[i+1] += a[i] c = [0] * (n-k+1) for i in range(n-k, -1, -1): c[i] = b[i+k] b[i] -= b[i+k] b[i+k] = 0 return c def solve(n, k, a): v = [0] * k for i in range(n): v[i%k] += a[i] if n % k == 0: if v != [v[0]] * k: return False b = flat_division(n, a, k) return all(i % k == 0 or b[i] <= 0 for i in range(n-k+1)) else: x = v[0] - v[-1] for i in range(k): if v[i] != (v[0] if i < n % k else v[-1]): return False for i in range(n): a[i] -= x b = flat_division(n, a, k) return all(b[i] <= 0 for i in range(n-k+1)) T = int(input()) for _ in range(T): n, k, x = map(int, input().split()) h = list(map(int, input().split())) if not all(h[i] % x == h[0] % x for i in range(n)): print('No') else: for i in range(n): h[i] //= x print('Yes' if solve(n, k, h) else 'No')