結果

問題 No.396 クラス替え
ユーザー vjudge1
提出日時 2025-05-20 21:18:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 830 bytes
コンパイル時間 3,835 ms
コンパイル使用メモリ 272,844 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-20 21:18:26
合計ジャッジ時間 3,637 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
//#define USE_FREOPEN
//#define MUL_TEST
#define FILENAME "class"
using namespace std;
// class x: I (n-1)%(2m)=x-1
//          II (n-1)%(2m)=2m-x+1

void solve() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	int xc, yc;
	if ((x - 1) % (2 * m) < m) xc = ((x - 1) % (2 * m)) + 1;
	else xc = 2 * m - ((x - 1) % (2 * m));
	if ((y - 1) % (2 * m) < m) yc = ((y - 1) % (2 * m)) + 1;
	else yc = 2 * m - ((y - 1) % (2 * m));
//	cerr << xc << ' ' << yc << '\n';
	cout << (xc == yc ? "YES\n" : "NO\n");
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);

	#ifdef USE_FREOPEN
		freopen(FILENAME ".in","r",stdin);
		freopen(FILENAME ".out","w",stdout);
	#endif
	int _ = 1;
	#ifdef MUL_TEST
		cin >> _;
	#endif
	while (_--)
		solve();
	_^=_;
	return 0^_^0;
}

0