結果

問題 No.396 クラス替え
ユーザー te-sh
提出日時 2017-07-27 11:57:44
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 339 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 99,220 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 21:14:35
合計ジャッジ時間 1,557 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd1 = readln.split.to!(int[]), n = rd1[0], m = rd1[1];
  auto rd2 = readln.split.to!(int[]), x = rd2[0], y = rd2[1];

  auto cls(int z)
  {
    auto k = (z-1) % (m*2);
    return k < m ? k+1 : m*2-k;
  }

  writeln(cls(x) == cls(y) ? "YES" : "NO");
}
0