結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2019-01-20 07:37:46 |
言語 | Nim (2.2.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,202 bytes |
コンパイル時間 | 2,886 ms |
コンパイル使用メモリ | 67,328 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-01 10:24:00 |
合計ジャッジ時間 | 4,367 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 3 |
other | AC * 22 WA * 18 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 54) Warning: imported and not used: 'strformat' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport] /home/judge/data/code/Main.nim(1, 47) Warning: imported and not used: 'macros' [UnusedImport] /home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformat proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0' or k > '9': break else: result = 10 * result + k.ord - '0'.ord let h = scan() let w = scan() var S = newSeqWith(w,newSeqWith(h,false)) var blockSum = 0 for y in 0..<h: for x in 0..<w: let s = getchar_unlocked() == '#' S[x][y] = s if s : blockSum += 1 discard getchar_unlocked() iterator chair*[T](w,h:int): tuple[x,y:int] = for n in 0..w + h: for x in 0.max(n-h+1)..n.min(w-1): yield (x,n-x) if blockSum <= 1: quit "NO",0 proc check(sx,sy:int) = if sx == 0 and sy == 0 : return var already = newSeqWith(w,newSeqWith(h,false)) for xy in 0.countdown(0): break for x in 0..<w: for y in 0..<h: if not S[x][y] : continue if already[x][y]:continue if x + sx >= w or y + sy >= h : return if not S[x+sx][y+sy]: return already[x+sx][y+sy] = true quit "YES",0 for sx in 0..<w: for sy in 0..<h: check(sx,sy) for x in 0..<w: S[x].reverse() for sx in 0..<w: for sy in 0..<h: check(sx,sy) echo "NO"