結果

問題 No.274 The Wall
ユーザー むらためむらため
提出日時 2019-02-03 23:25:38
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 751 bytes
コンパイル時間 2,648 ms
コンパイル使用メモリ 69,920 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 03:24:15
合計ジャッジ時間 3,868 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,algorithm
template times*(n:int,body) = (for _ in 0..<n: body)



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

let n = scan()
let m = scan()
var U = newSeq[bool](m)
let LR = newSeqWith(n,(l:scan(),r:scan()))
  .map(proc(x:tuple[l,r:int]):tuple[l,r:int] =
    if x.l < m-1-x.r: return x
    return (m-1-x.r,m-1-x.l)
  ).sortedByIt(it.l)
proc fill(l,r:int) : bool =
  for i in l..r:
    if U[i] : return false
  for i in l..r: U[i] = true
  return true
for lr in LR:
  let (l,r) = lr
  if fill(l,r) : continue
  if fill(m-r-1,m-l-1) : continue
  quit "NO",0
echo "YES"
0