結果

問題 No.396 クラス替え
ユーザー Seki-tSeki-t
提出日時 2016-08-12 21:16:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 746 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 65,592 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 17:19:05
合計ジャッジ時間 1,227 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)


int N,M,X,Y;


int main(){
	cin>>N>>M;
	cin>>X>>Y;
	bool kekka = false;
	if(M == 1)kekka = true;
	int p = X % (2*M);
	int q = Y % (2*M);
	if(p <= M && (q > M || q == 0)){
		int k = 2*M - p + 1;
		if(k%(2*M) == q)kekka = true;
	}
	else if((p > M || p==0) && q <= M){
		int k = 2 * M - q + 1;
		if(k%(2*M) == p)kekka = true;
	}
	else{
		if(p == q){
			kekka = true;
		}
	}
	
	if(kekka){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}

	return 0;
	
}

0