結果

問題 No.2860 Heal Slimes
ユーザー 👑 rin204rin204
提出日時 2024-08-25 16:11:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 976 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 107,044 KB
最終ジャッジ日時 2024-08-25 16:11:32
合計ジャッジ時間 10,526 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
77,364 KB
testcase_01 WA -
testcase_02 AC 220 ms
77,428 KB
testcase_03 AC 233 ms
77,348 KB
testcase_04 AC 226 ms
77,716 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 85 ms
75,632 KB
testcase_11 AC 85 ms
75,656 KB
testcase_12 AC 79 ms
75,768 KB
testcase_13 AC 83 ms
75,520 KB
testcase_14 AC 79 ms
75,528 KB
testcase_15 AC 94 ms
75,864 KB
testcase_16 AC 90 ms
76,152 KB
testcase_17 AC 93 ms
75,728 KB
testcase_18 AC 94 ms
76,196 KB
testcase_19 AC 95 ms
76,168 KB
testcase_20 AC 87 ms
100,720 KB
testcase_21 AC 90 ms
100,660 KB
testcase_22 AC 73 ms
90,332 KB
testcase_23 AC 106 ms
102,276 KB
testcase_24 AC 94 ms
104,452 KB
testcase_25 AC 76 ms
96,560 KB
testcase_26 AC 65 ms
85,832 KB
testcase_27 AC 92 ms
101,284 KB
testcase_28 AC 90 ms
104,192 KB
testcase_29 AC 80 ms
97,624 KB
testcase_30 AC 94 ms
106,184 KB
testcase_31 AC 99 ms
107,036 KB
testcase_32 AC 96 ms
107,044 KB
testcase_33 AC 91 ms
106,256 KB
testcase_34 AC 102 ms
101,928 KB
testcase_35 AC 94 ms
106,832 KB
testcase_36 AC 92 ms
105,712 KB
testcase_37 AC 96 ms
106,980 KB
testcase_38 AC 93 ms
106,180 KB
testcase_39 AC 96 ms
106,732 KB
testcase_40 AC 110 ms
102,288 KB
testcase_41 AC 108 ms
102,032 KB
testcase_42 AC 108 ms
102,220 KB
testcase_43 AC 107 ms
102,700 KB
testcase_44 AC 110 ms
102,316 KB
testcase_45 AC 108 ms
101,996 KB
testcase_46 AC 109 ms
102,168 KB
testcase_47 AC 108 ms
102,312 KB
testcase_48 AC 107 ms
102,308 KB
testcase_49 AC 108 ms
101,964 KB
testcase_50 AC 109 ms
102,428 KB
testcase_51 AC 106 ms
102,068 KB
testcase_52 AC 106 ms
102,012 KB
testcase_53 AC 108 ms
102,184 KB
testcase_54 AC 118 ms
102,680 KB
testcase_55 AC 106 ms
102,072 KB
testcase_56 AC 106 ms
102,544 KB
testcase_57 AC 108 ms
102,316 KB
testcase_58 AC 106 ms
102,168 KB
testcase_59 AC 107 ms
101,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n, k, x = map(int, input().split())
    H = list(map(int, input().split()))
    if len(set(h % x for h in H)) != 1:
        print("No")
        return

    tot = [0] * k
    H = [h // x for h in H]
    ma = max(H)

    for i, h in enumerate(H):
        tot[i % k] += ma - h

    bef = tot[: n % k]
    aft = tot[n % k :]
    if bef and len(set(bef)) >= 2:
        print("No")
        return
    if aft and len(set(aft)) >= 2:
        print("No")
        return

    if bef and aft:
        if bef[0] > aft[0]:
            print("No")
            return

        d = aft[0] - bef[0]
        goal = ma + d
        minus = [0] * n
        tot = 0
        for i, h in enumerate(H):
            tot -= minus[i]
            h += tot
            if h > goal:
                print("No")
                return
            tot += goal - h
            if i + k < n:
                minus[i + k] = goal - h

    print("Yes")


for _ in range(int(input())):
    solve()
0