結果
問題 | No.274 The Wall |
ユーザー |
|
提出日時 | 2019-02-03 23:25:38 |
言語 | Nim (2.2.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 751 bytes |
コンパイル時間 | 2,543 ms |
コンパイル使用メモリ | 62,304 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 11:18:28 |
合計ジャッジ時間 | 3,360 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 10 WA * 12 |
ソースコード
import sequtils,algorithmtemplate 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': returnresult = 10 * result + k.ord - '0'.ordlet 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 xreturn (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 falsefor i in l..r: U[i] = truereturn truefor lr in LR:let (l,r) = lrif fill(l,r) : continueif fill(m-r-1,m-l-1) : continuequit "NO",0echo "YES"