結果

問題 No.396 クラス替え
ユーザー nanae
提出日時 2017-03-25 06:20:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 28 ms / 1,000 ms
コード長 530 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-06 04:08:14
合計ジャッジ時間 1,190 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

def solve():
    n, m = map(int, input().split())
    x, y = map(int, input().split())
    x, y = x - 1, y - 1

    ans = 'YES' if furiwake(m, x) == furiwake(m, y) else 'NO'

    print(ans)

def furiwake(m, x):
    if (x // m) & 1:
        return m - 1 - (x % m)
    else:
        return x % m

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

if __name__ == '__main__':
    solve()
0