結果

問題 No.179 塗り分け
ユーザー maspymaspy
提出日時 2020-02-02 13:43:45
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 11,920 KB
実行使用メモリ 10,192 KB
最終ジャッジ日時 2023-10-19 00:47:16
合計ジャッジ時間 4,638 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,152 KB
testcase_01 AC 38 ms
10,152 KB
testcase_02 AC 30 ms
10,152 KB
testcase_03 AC 36 ms
10,152 KB
testcase_04 AC 30 ms
10,152 KB
testcase_05 AC 58 ms
10,152 KB
testcase_06 AC 30 ms
10,152 KB
testcase_07 WA -
testcase_08 AC 70 ms
10,176 KB
testcase_09 AC 95 ms
10,176 KB
testcase_10 AC 30 ms
10,176 KB
testcase_11 AC 31 ms
10,172 KB
testcase_12 AC 102 ms
10,172 KB
testcase_13 AC 38 ms
10,152 KB
testcase_14 AC 38 ms
10,152 KB
testcase_15 AC 36 ms
10,152 KB
testcase_16 AC 29 ms
10,152 KB
testcase_17 WA -
testcase_18 AC 31 ms
10,176 KB
testcase_19 AC 30 ms
10,176 KB
testcase_20 AC 81 ms
10,176 KB
testcase_21 AC 218 ms
10,176 KB
testcase_22 AC 680 ms
10,176 KB
testcase_23 AC 30 ms
10,176 KB
testcase_24 AC 103 ms
10,176 KB
testcase_25 AC 31 ms
10,176 KB
testcase_26 AC 38 ms
10,176 KB
testcase_27 AC 74 ms
10,176 KB
testcase_28 AC 34 ms
10,176 KB
testcase_29 AC 73 ms
10,176 KB
testcase_30 AC 52 ms
10,176 KB
testcase_31 AC 80 ms
10,176 KB
testcase_32 AC 42 ms
10,176 KB
testcase_33 AC 74 ms
10,176 KB
testcase_34 AC 38 ms
10,176 KB
testcase_35 AC 74 ms
10,176 KB
testcase_36 AC 37 ms
10,152 KB
testcase_37 AC 37 ms
10,152 KB
testcase_38 AC 37 ms
10,152 KB
testcase_39 AC 37 ms
10,152 KB
testcase_40 AC 38 ms
10,152 KB
testcase_41 AC 38 ms
10,152 KB
testcase_42 AC 38 ms
10,152 KB
testcase_43 AC 42 ms
10,152 KB
testcase_44 AC 49 ms
10,156 KB
testcase_45 AC 40 ms
10,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

H,W = map(int,readline().split())
data = ''.join(read().decode().split())

def test(a,b):
    if a==b==0:
        return False
    close = [0] * (H*W)
    for x,y in itertools.product(range(H), range(W)):
        ind = W*x + y
        if close[ind]:
            continue
        if data[ind] == '.':
            continue
        x1,y1 = x+a, y+b
        if x1 >= H or y1 < 0 or y1 >= W:
            return False
        ind1 = W*x1 + y1
        if data[ind1] == '.':
            return False
        close[ind] = 1
        close[ind1] = 1
    return True

answer = 'YES' if any(test(a,b) for a in range(51) for b in range(-51,51)) else 'NO'
print(answer)
0