結果

問題 No.396 クラス替え
ユーザー sima.tetteke
提出日時 2019-09-22 12:03:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 625 bytes
コンパイル時間 1,385 ms
コンパイル使用メモリ 157,396 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 03:29:10
合計ジャッジ時間 1,698 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
ll N;

ll findClass(ll M, ll X){
    ll ans = 0;

    if(X % M == 0){
        if(X / M % 2 == 1){
            return M;
        }else{
            return 1;
        }
    }

    if(X / M % 2 == 0){
        return X % M;
    }else{
        return M - X % M + 1;
    }

}

int main(){

    ll N, M, X, Y;
    cin >> N >> M >> X >> Y;

    ll classA = findClass(M, X);
    ll classB = findClass(M, Y);

    //cout  << classA << ", " << classB << endl;

    if(classA == classB){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

} 
0