結果

問題 No.2456 Stamp Art
ユーザー mkawa2mkawa2
提出日時 2023-09-01 22:53:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,165 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 87,376 KB
実行使用メモリ 158,016 KB
最終ジャッジ日時 2023-09-01 22:53:22
合計ジャッジ時間 12,507 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,524 KB
testcase_01 AC 66 ms
71,516 KB
testcase_02 AC 67 ms
71,352 KB
testcase_03 AC 556 ms
158,016 KB
testcase_04 AC 78 ms
71,348 KB
testcase_05 WA -
testcase_06 AC 556 ms
157,604 KB
testcase_07 AC 538 ms
152,776 KB
testcase_08 AC 873 ms
155,612 KB
testcase_09 AC 550 ms
149,320 KB
testcase_10 AC 569 ms
150,952 KB
testcase_11 AC 546 ms
149,416 KB
testcase_12 AC 557 ms
151,808 KB
testcase_13 AC 537 ms
157,792 KB
testcase_14 AC 555 ms
155,332 KB
testcase_15 AC 540 ms
157,896 KB
testcase_16 RE -
testcase_17 WA -
testcase_18 AC 77 ms
75,808 KB
testcase_19 WA -
testcase_20 AC 538 ms
156,292 KB
testcase_21 RE -
testcase_22 AC 551 ms
152,668 KB
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(1000005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = -1-(-1 << 63)
# md = 10**9+7
md = 998244353

def RLE(s):
    kk=[]
    vv=[]
    for c in s:
        if kk and kk[-1]==c:
            vv[-1]+=1
        else:
            kk.append(c)
            vv.append(1)
    return kk,vv

h,w=LI()
ss=[[c=="#" for c in SI()] for _ in range(h)]

ans=inf
for _ in range(2):
    for i in range(h):
        kk,vv=RLE(ss[i])
        for k,v in zip(kk,vv):
            if k:ans=min(ans,v)
    ss=[col for col in zip(*ss)]

print(ans)
0