結果

問題 No.179 塗り分け
ユーザー buey_tbuey_t
提出日時 2023-03-24 09:55:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,324 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 92,532 KB
最終ジャッジ日時 2023-10-18 19:58:29
合計ジャッジ時間 13,931 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
83,988 KB
testcase_01 AC 134 ms
83,988 KB
testcase_02 AC 130 ms
83,988 KB
testcase_03 AC 129 ms
83,992 KB
testcase_04 AC 144 ms
88,112 KB
testcase_05 AC 222 ms
89,600 KB
testcase_06 AC 142 ms
88,140 KB
testcase_07 AC 144 ms
88,368 KB
testcase_08 AC 438 ms
90,608 KB
testcase_09 WA -
testcase_10 AC 151 ms
88,924 KB
testcase_11 AC 151 ms
88,916 KB
testcase_12 AC 397 ms
90,988 KB
testcase_13 AC 148 ms
88,668 KB
testcase_14 AC 153 ms
88,872 KB
testcase_15 AC 128 ms
83,996 KB
testcase_16 AC 129 ms
83,996 KB
testcase_17 AC 131 ms
84,000 KB
testcase_18 AC 161 ms
89,008 KB
testcase_19 AC 162 ms
89,012 KB
testcase_20 AC 419 ms
90,664 KB
testcase_21 AC 455 ms
92,288 KB
testcase_22 AC 474 ms
92,072 KB
testcase_23 AC 149 ms
88,804 KB
testcase_24 AC 453 ms
92,016 KB
testcase_25 AC 161 ms
88,948 KB
testcase_26 WA -
testcase_27 AC 466 ms
90,756 KB
testcase_28 WA -
testcase_29 AC 458 ms
91,064 KB
testcase_30 WA -
testcase_31 AC 433 ms
90,832 KB
testcase_32 AC 236 ms
89,120 KB
testcase_33 AC 454 ms
92,532 KB
testcase_34 WA -
testcase_35 AC 449 ms
90,776 KB
testcase_36 AC 129 ms
83,996 KB
testcase_37 AC 131 ms
83,996 KB
testcase_38 AC 132 ms
83,996 KB
testcase_39 AC 131 ms
83,996 KB
testcase_40 AC 147 ms
88,656 KB
testcase_41 AC 132 ms
83,996 KB
testcase_42 AC 145 ms
88,124 KB
testcase_43 AC 169 ms
89,028 KB
testcase_44 AC 200 ms
89,076 KB
testcase_45 AC 156 ms
88,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    from heapq import heapify, heappop, heappush
    from bisect import bisect_left, bisect_right
    from copy import deepcopy
    import copy
    import random
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_,itemgetter
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    
    
    '''
    H,Wが小さい
    4重ループまでは回る
    最左上を赤で塗るとして、そこからどう平行移動するのかを全探索する
    
    '''
    
    H,W = map(int, input().split())
    S = [list(input()) for _ in range(H)]
    
    sy = -1
    sx = -1
    
    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                sy = i
                sx = j
                break
    
    if sy == -1:
        print('NO')
        exit()
    
    for dy in range(H):
        for dx in range(W):
            
            if dy == dx == 0:
                continue
            
            T = deepcopy(S)
            f = True
            
            for i in range(H):
                for j in range(W):
                    if T[i][j] == '#':
                        if i+dy>=H or j+dx>=W:
                            f = False
                            break
                        
                        if T[i+dy][j+dx] == '#':
                            T[i][j] = '.'
                            T[i+dy][j+dx] = '.'
                        else:
                            f = False
                            break
                
                else:
                    continue
                break
            
            if f:
                print('YES')
                exit()
    
    print('NO')
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0