結果

問題 No.396 クラス替え
ユーザー koyumeishikoyumeishi
提出日時 2015-03-21 01:57:48
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 449 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 54,652 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 10:42:40
合計ジャッジ時間 1,152 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include "assert.h"

using namespace std;

int main(){
	long long N,M,X,Y;
	cin >> N >> M >> X >> Y;
	
	assert(2<=N && N<=1000000000);
	assert(1<=M && M<=1000000000);
	assert(1<=X && X<=N);
	assert(1<=Y && Y<=N);
	assert(X!=Y);
	

	auto get_class = [&](long long Z) -> long long{
		Z--;
		if( (Z/M)%2 == 0 ) return Z%M + 1;
		else return M - Z%M;
	};
	
	cout << ( get_class(X)==get_class(Y) ? "YES" : "NO" ) << endl;
	return 0;
}
0