結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 23 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 15 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 10 ms
4,376 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,376 KB
testcase_30 WA -
testcase_31 AC 10 ms
4,380 KB
testcase_32 AC 4 ms
4,380 KB
testcase_33 AC 10 ms
4,380 KB
testcase_34 WA -
testcase_35 AC 10 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,384 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 1 ms
4,376 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 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])
    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 or co mod 2 == 1:
    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:
            break
          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 tmpCo == co div 2 and not flag:
        return "YES"
  return "NO"

echo(solve())
0