結果

問題 No.179 塗り分け
ユーザー yozayoza
提出日時 2015-04-06 01:56:00
言語 Nim
(2.0.2)
結果
AC  
実行時間 27 ms / 3,000 ms
コード長 1,233 bytes
コンパイル時間 4,169 ms
コンパイル使用メモリ 68,648 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 20:38:32
合計ジャッジ時間 5,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 9 ms
4,376 KB
testcase_09 AC 10 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 9 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 9 ms
4,376 KB
testcase_21 AC 14 ms
4,380 KB
testcase_22 AC 27 ms
4,380 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 10 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 10 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 9 ms
4,380 KB
testcase_30 AC 5 ms
4,380 KB
testcase_31 AC 10 ms
4,376 KB
testcase_32 AC 4 ms
4,380 KB
testcase_33 AC 9 ms
4,376 KB
testcase_34 AC 3 ms
4,384 KB
testcase_35 AC 9 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 3 ms
4,376 KB
testcase_45 AC 1 ms
4,380 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])
    co: int
    # tmpCo: int
    flag = false

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

  if co == 0:
    return "NO"

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

echo(solve())
0