結果

問題 No.396 クラス替え
ユーザー lam6er
提出日時 2025-03-20 21:06:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 1,000 ms
コード長 306 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,780 KB
実行使用メモリ 53,788 KB
最終ジャッジ日時 2025-03-20 21:06:12
合計ジャッジ時間 1,615 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
X, Y = map(int, input().split())

def calculate_class(k, M):
    q = (k - 1) // M
    mod = (k - 1) % M
    if q % 2 == 0:
        return mod + 1
    else:
        return M - mod

c_x = calculate_class(X, M)
c_y = calculate_class(Y, M)

print("YES" if c_x == c_y else "NO")
0