結果

問題 No.179 塗り分け
ユーザー むらためむらため
提出日時 2019-01-20 07:37:46
言語 Nim
(2.0.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,202 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 66,520 KB
実行使用メモリ 5,772 KB
最終ジャッジ日時 2023-09-14 02:20:58
合計ジャッジ時間 4,568 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 5 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 26 ms
5,340 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 26 ms
5,660 KB
testcase_21 AC 37 ms
5,548 KB
testcase_22 AC 32 ms
5,696 KB
testcase_23 WA -
testcase_24 AC 28 ms
5,616 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 26 ms
5,608 KB
testcase_28 WA -
testcase_29 AC 27 ms
5,592 KB
testcase_30 WA -
testcase_31 AC 28 ms
5,696 KB
testcase_32 WA -
testcase_33 AC 27 ms
5,684 KB
testcase_34 WA -
testcase_35 AC 28 ms
5,640 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 5 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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]

ソースコード

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

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"
0