結果

問題 No.396 クラス替え
ユーザー tonyu0
提出日時 2020-05-17 19:17:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 447 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 93,052 KB
最終ジャッジ日時 2025-01-10 12:45:01
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

ll n, m, x, y;

int main()
{
  cin >> n >> m >> x >> y;
  --x, --y;
  ll xshou = x / m, xamari = x % m, yshou = y / m, yamari = y % m;
  ll xclass = (xshou & 1 ? m - xamari - 1 : xamari);
  ll yclass = (yshou & 1 ? m - yamari - 1 : yamari);
  cout << (xclass == yclass ? "YES" : "NO") << endl;

  return 0;
}
0