結果

問題 No.179 塗り分け
ユーザー siganaisiganai
提出日時 2022-05-26 16:33:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,321 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 81,604 KB
実行使用メモリ 77,196 KB
最終ジャッジ日時 2023-10-20 19:29:32
合計ジャッジ時間 5,027 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
63,540 KB
testcase_01 AC 57 ms
63,540 KB
testcase_02 AC 57 ms
63,540 KB
testcase_03 AC 58 ms
63,540 KB
testcase_04 AC 61 ms
63,540 KB
testcase_05 AC 57 ms
63,540 KB
testcase_06 AC 58 ms
63,540 KB
testcase_07 AC 67 ms
66,076 KB
testcase_08 AC 63 ms
66,216 KB
testcase_09 AC 60 ms
66,216 KB
testcase_10 AC 65 ms
68,488 KB
testcase_11 AC 65 ms
68,488 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 58 ms
63,544 KB
testcase_15 AC 58 ms
63,544 KB
testcase_16 AC 59 ms
63,544 KB
testcase_17 AC 58 ms
63,544 KB
testcase_18 AC 68 ms
68,492 KB
testcase_19 AC 68 ms
70,536 KB
testcase_20 AC 60 ms
66,140 KB
testcase_21 AC 59 ms
66,076 KB
testcase_22 WA -
testcase_23 AC 65 ms
68,356 KB
testcase_24 WA -
testcase_25 AC 64 ms
66,216 KB
testcase_26 AC 69 ms
70,536 KB
testcase_27 WA -
testcase_28 AC 69 ms
70,596 KB
testcase_29 AC 99 ms
77,048 KB
testcase_30 AC 87 ms
76,992 KB
testcase_31 WA -
testcase_32 AC 98 ms
77,060 KB
testcase_33 AC 104 ms
77,196 KB
testcase_34 AC 84 ms
76,940 KB
testcase_35 WA -
testcase_36 AC 58 ms
63,544 KB
testcase_37 AC 57 ms
63,544 KB
testcase_38 AC 58 ms
63,544 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 58 ms
63,544 KB
testcase_42 WA -
testcase_43 AC 68 ms
70,512 KB
testcase_44 AC 75 ms
74,240 KB
testcase_45 AC 61 ms
66,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools

mod=10 ** 9 + 7

import sys
input = sys.stdin.readline

h,w=map(int,input().split())
s = [input().rstrip() for _ in range(h)]
li = []
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            li.append((i,j))
if len(li) % 2:
    print('NO')
else:
    for i in range(1,len(li)):
        px = li[i][0] - li[0][0]
        py = li[i][1] - li[0][1]
        ns = [[0] * w for _ in range(h)]
        flg = 0
        for j in range(h):
            for k in range(w):
                if s[j][k] == '#':
                    if ns[j][k]:
                        continue
                    ns[j][k] = 1
                    if 0 <= j + px < h and 0 <= k + py < w:
                        if s[j + px][k + py] and ns[j + px][k + py] == 0:
                            ns[j + px][k + py] = 1
                        else:
                            flg = 1
                            break
                    else:
                        flg = 1
                        break
            if flg:
                break
        if not flg:
            print('YES')
            exit()
    print('NO')
0