結果

問題 No.179 塗り分け
ユーザー むらため
提出日時 2019-01-20 07:19:19
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 954 bytes
コンパイル時間 2,722 ms
コンパイル使用メモリ 67,200 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-01 10:24:08
合計ジャッジ時間 4,170 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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, 26) Warning: imported and not used: 'algorithm' [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]
/home/judge/data/code/Main.nim(1, 47) Warning: imported and not used: 'macros' [UnusedImport]

ソースコード

diff #

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()

if blockSum <= 1: quit "NO",0
proc check(sx,sy:int) =
  var already = newSeqWith(w,newSeqWith(h,false))
  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 x in 0..<w:
  for y in 0..<h:
    if x == 0 and y == 0 : continue
    check(x,y)
echo "NO"
0