結果

問題 No.179 塗り分け
ユーザー gorugo30gorugo30
提出日時 2021-03-16 23:15:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 423 ms / 3,000 ms
コード長 973 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 77,160 KB
最終ジャッジ日時 2024-04-26 06:15:25
合計ジャッジ時間 9,390 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,096 KB
testcase_01 AC 38 ms
52,480 KB
testcase_02 AC 37 ms
52,864 KB
testcase_03 AC 38 ms
52,736 KB
testcase_04 AC 47 ms
59,392 KB
testcase_05 AC 109 ms
76,400 KB
testcase_06 AC 83 ms
76,648 KB
testcase_07 AC 38 ms
51,968 KB
testcase_08 AC 418 ms
76,672 KB
testcase_09 AC 423 ms
76,808 KB
testcase_10 AC 184 ms
76,476 KB
testcase_11 AC 174 ms
76,676 KB
testcase_12 AC 273 ms
76,984 KB
testcase_13 AC 46 ms
60,672 KB
testcase_14 AC 50 ms
63,360 KB
testcase_15 AC 36 ms
52,096 KB
testcase_16 AC 36 ms
52,096 KB
testcase_17 AC 37 ms
52,224 KB
testcase_18 AC 199 ms
77,072 KB
testcase_19 AC 190 ms
76,636 KB
testcase_20 AC 286 ms
76,860 KB
testcase_21 AC 386 ms
77,160 KB
testcase_22 AC 413 ms
76,928 KB
testcase_23 AC 206 ms
76,428 KB
testcase_24 AC 406 ms
76,892 KB
testcase_25 AC 230 ms
76,416 KB
testcase_26 AC 217 ms
77,044 KB
testcase_27 AC 372 ms
76,924 KB
testcase_28 AC 226 ms
76,672 KB
testcase_29 AC 368 ms
76,800 KB
testcase_30 AC 288 ms
76,928 KB
testcase_31 AC 380 ms
76,836 KB
testcase_32 AC 268 ms
76,852 KB
testcase_33 AC 356 ms
77,000 KB
testcase_34 AC 258 ms
77,088 KB
testcase_35 AC 350 ms
76,852 KB
testcase_36 AC 40 ms
52,608 KB
testcase_37 AC 40 ms
52,480 KB
testcase_38 AC 37 ms
52,224 KB
testcase_39 AC 37 ms
52,096 KB
testcase_40 AC 38 ms
53,120 KB
testcase_41 AC 37 ms
52,096 KB
testcase_42 AC 37 ms
52,480 KB
testcase_43 AC 86 ms
76,892 KB
testcase_44 AC 120 ms
76,928 KB
testcase_45 AC 62 ms
69,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
grid = [input() for i in range(H)]

cnt = sum([grid[i].count("#") for i in range(H)])
if cnt < 2:
    print("NO")
    exit()
for tatehoukounoshift in range(-(H - 1), H):
    for yokohoukounoshift in range(-(W - 1), W):
        if tatehoukounoshift == yokohoukounoshift == 0:
            continue
        can = True
        used = [[False] * W for i in range(H)]
        for i in range(H):
            for j in range(W):
                if used[i][j] or grid[i][j] == ".":
                    continue
                if not (0 <= i + tatehoukounoshift < H and 0 <= j + yokohoukounoshift < W):
                    can = False
                    break
                if grid[i + tatehoukounoshift][j + yokohoukounoshift] == ".":
                    can = False
                used[i][j] = True
                used[i + tatehoukounoshift][j + yokohoukounoshift] = True
        if can:
            print("YES")
            exit()
print("NO")
0