結果

問題 No.870 無敵囲い
ユーザー むらためむらため
提出日時 2019-09-03 03:31:44
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 300 ms
コード長 548 bytes
コンパイル時間 2,146 ms
コンパイル使用メモリ 61,304 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-29 06:22:46
合計ジャッジ時間 2,565 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" ,discardable.}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': return
    result = 10 * result + k.ord - '0'.ord

let n = scan()
proc toI(x,y:int):int = x * 10 + y
var poses = @[toI(2,8),toI(3,9),toI(7,9)]
for _ in 0..<n:
  let a = toI(scan(),scan())
  let b = toI(scan(),scan())
  for i in 0..<3:
    if poses[i] == a:
      poses[i] = b
      break
if poses == @[toI(5,8),toI(4,8),toI(6,8)]: echo "YES"
else: echo "NO"
0