結果

問題 No.240 ナイト散歩
コンテスト
ユーザー kou_kkk
提出日時 2025-02-21 12:35:21
言語 Nim
(2.2.12 + ACL)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 690µs
コード長 602 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,643 ms
コンパイル使用メモリ 70,572 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-10-28 17:34:44
合計ジャッジ時間 5,809 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sequtils, strscans

const
  m = [
    (1, 2),
    (1, -2),
    (2, 1),
    (2, -1),
    (-1, 2),
    (-1, -2),
    (-2, 1),
    (-2, -1),
  ]

var
  b = false.repeat(13).repeat(13)
  list = [@[(6, 6)], @[], @[], @[]]

b[6][6] = true

for i in 0 ..< 3:
  for (lx, ly) in list[i]:
    for (mx, my) in m:
      if b[lx + mx][ly + my]:
        continue
      else:
        b[lx + mx][ly + my] = true
        list[i.succ].add (lx + mx, ly + my)


let
  (_, x, y) = stdin.readLine.scanTuple "$i $i"

if x.abs > 6 or y.abs > 6:
  echo "NO"
  quit()

echo:
  if b[x.succ 6][y.succ 6]: "YES"
  else: "NO"
0