結果

問題 No.179 塗り分け
ユーザー yozayoza
提出日時 2015-04-06 01:45:10
言語 Nim
(2.0.2)
結果
RE  
実行時間 -
コード長 1,226 bytes
コンパイル時間 4,119 ms
コンパイル使用メモリ 69,000 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-11 10:58:11
合計ジャッジ時間 4,598 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
4,376 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
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 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 WA -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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):
        if hMove + h >= hw[0]:
          break
        for w in countup(0, hw[1] - 1):
          if wMove + w >= hw[1] or wMove + w < 0:
            if tBoard[h][w] == '#':
              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