結果

問題 No.179 塗り分け
ユーザー yozayoza
提出日時 2015-04-06 01:28:09
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 1,220 bytes
コンパイル時間 3,350 ms
コンパイル使用メモリ 68,908 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 10:57:38
合計ジャッジ時間 6,322 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 10 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 24 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 16 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 10 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 WA -
testcase_27 AC 10 ms
4,376 KB
testcase_28 WA -
testcase_29 AC 10 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 10 ms
4,376 KB
testcase_32 AC 4 ms
4,376 KB
testcase_33 AC 10 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 10 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 3 ms
4,380 KB
testcase_45 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, algorithm, math

proc solve(): string =
  var
    hw = readLine(stdin).split(' ').map(parseInt)
    board = newSeq[string](hw[0])
    tBoard = newSeq[string](hw[0])
    count = 0
    tmpCount: int
    flag = false

  for i in countup(0, hw[0] - 1):
    board[i] = readLine(stdin)
    count += board[i].count('#')

  if count mod 2 == 1:
    return "NO"

  for hMove in countup(0, hw[0] - 1):
    for wMove in countup(-hw[1] + 1, hw[1] - 1):
      tmpCount = 0
      flag = false
      for h in countup(0, hw[0] - 1):
        tBoard[h] = board[h]
      for h in countup(0, hw[0] - 1):
        if hMove + h >= hw[0]:
          break
        for w in countup(0, hw[1] - 1):
          if wMove + w >= hw[1] or wMove + w < 0:
            break
          if tBoard[h][w] == '#':
            if tBoard[hMove + h][wMove + w] == '#':
              tmpCount += 1
              tBoard[h][w] = 'R'
              tBoard[hMove + h][wMove + w] = 'B'
            else:
              flag = true
              break
          # else:
          #   flag = true
          #   break
        if flag:
          break
      if tmpCount == count div 2 and not flag:
        return "YES"
  return "NO"

echo(solve())
0