結果

問題 No.2860 Heal Slimes
ユーザー rin204
提出日時 2024-08-25 15:57:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 610 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 107,232 KB
最終ジャッジ日時 2024-08-25 15:58:04
合計ジャッジ時間 10,185 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50 WA * 10
権限があれば一括ダウンロードができます

ソースコード

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

    cnt = [0] * k
    ma = max(H)
    for i, h in enumerate(H):
        cnt[i % k] += (ma - h) // x

    bef = cnt[: n % k]
    aft = cnt[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

    print("Yes")


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