結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 234 ms
77,328 KB
testcase_01 WA -
testcase_02 AC 236 ms
77,352 KB
testcase_03 AC 251 ms
77,324 KB
testcase_04 AC 235 ms
77,296 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 84 ms
75,652 KB
testcase_11 AC 83 ms
75,904 KB
testcase_12 AC 84 ms
75,944 KB
testcase_13 AC 96 ms
75,888 KB
testcase_14 AC 83 ms
75,588 KB
testcase_15 AC 107 ms
75,732 KB
testcase_16 AC 96 ms
75,796 KB
testcase_17 AC 100 ms
76,140 KB
testcase_18 AC 104 ms
76,104 KB
testcase_19 AC 105 ms
76,136 KB
testcase_20 AC 91 ms
100,436 KB
testcase_21 AC 94 ms
100,564 KB
testcase_22 AC 73 ms
91,144 KB
testcase_23 AC 111 ms
101,976 KB
testcase_24 AC 97 ms
104,456 KB
testcase_25 AC 80 ms
94,800 KB
testcase_26 AC 72 ms
84,628 KB
testcase_27 AC 100 ms
101,316 KB
testcase_28 AC 100 ms
104,056 KB
testcase_29 AC 80 ms
97,576 KB
testcase_30 AC 93 ms
106,104 KB
testcase_31 AC 97 ms
107,096 KB
testcase_32 AC 105 ms
106,820 KB
testcase_33 AC 94 ms
106,384 KB
testcase_34 AC 105 ms
102,152 KB
testcase_35 AC 98 ms
106,876 KB
testcase_36 AC 96 ms
105,600 KB
testcase_37 AC 104 ms
106,556 KB
testcase_38 AC 98 ms
106,276 KB
testcase_39 AC 98 ms
106,484 KB
testcase_40 AC 117 ms
102,052 KB
testcase_41 AC 114 ms
102,068 KB
testcase_42 AC 113 ms
101,988 KB
testcase_43 AC 109 ms
102,204 KB
testcase_44 AC 117 ms
102,092 KB
testcase_45 AC 119 ms
102,064 KB
testcase_46 AC 110 ms
102,044 KB
testcase_47 AC 120 ms
102,064 KB
testcase_48 AC 111 ms
102,340 KB
testcase_49 AC 111 ms
102,052 KB
testcase_50 AC 110 ms
102,452 KB
testcase_51 AC 112 ms
102,704 KB
testcase_52 AC 109 ms
102,080 KB
testcase_53 AC 111 ms
102,320 KB
testcase_54 AC 114 ms
102,316 KB
testcase_55 AC 111 ms
102,236 KB
testcase_56 AC 122 ms
102,728 KB
testcase_57 AC 116 ms
102,076 KB
testcase_58 AC 124 ms
102,324 KB
testcase_59 AC 118 ms
102,332 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
            if i + k >= n + 1 and goal - h > 0:
                print("No")
                return
            tot += goal - h
            if i + k < n:
                minus[i + k] = goal - h

    print("Yes")


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