結果

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

ソースコード

diff #

# https://yukicoder.me/problems/no/396


def select_class(class_M, rank):
    ans = rank % (2 * class_M)
    if ans == 0:
        return 1
    elif ans > class_M:
        return ans - (2 * (ans - class_M) - 1)
    else:
        return ans


def main():
    N, M = map(int, input().split())
    X, Y = map(int, input().split())
    hanako = select_class(M, X)
    taro = select_class(M, Y)
    if hanako == taro:
        print("YES")
    else:
        print("NO")


main()
0