結果

問題 No.396 クラス替え
ユーザー GrayCoder
提出日時 2018-08-12 21:33:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 559 bytes
コンパイル時間 1,606 ms
コンパイル使用メモリ 166,276 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 07:34:10
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

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

  int class_[2];
  int i = 0;
  for (int j : {X, Y}) {
    int d = (j - 1) / M;
    int m = (j - 1) % M;
    if (d % 2) {
      class_[i] = M - m;
    } else {
      class_[i] = m + 1;
    }
    i++;
  }
  if (class_[0] == class_[1])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}
0