結果
問題 | No.2641 draw X |
ユーザー | ponjuice |
提出日時 | 2024-02-11 18:09:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 364 ms / 2,000 ms |
コード長 | 1,349 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 82,164 KB |
実行使用メモリ | 124,488 KB |
最終ジャッジ日時 | 2024-09-28 18:23:48 |
合計ジャッジ時間 | 7,702 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
52,744 KB |
testcase_01 | AC | 34 ms
52,852 KB |
testcase_02 | AC | 36 ms
53,316 KB |
testcase_03 | AC | 35 ms
52,748 KB |
testcase_04 | AC | 33 ms
53,076 KB |
testcase_05 | AC | 33 ms
53,120 KB |
testcase_06 | AC | 37 ms
54,036 KB |
testcase_07 | AC | 38 ms
53,368 KB |
testcase_08 | AC | 37 ms
53,876 KB |
testcase_09 | AC | 37 ms
53,940 KB |
testcase_10 | AC | 38 ms
52,520 KB |
testcase_11 | AC | 35 ms
53,268 KB |
testcase_12 | AC | 34 ms
53,092 KB |
testcase_13 | AC | 34 ms
52,656 KB |
testcase_14 | AC | 35 ms
53,656 KB |
testcase_15 | AC | 164 ms
124,488 KB |
testcase_16 | AC | 289 ms
122,888 KB |
testcase_17 | AC | 36 ms
54,736 KB |
testcase_18 | AC | 37 ms
52,860 KB |
testcase_19 | AC | 35 ms
52,752 KB |
testcase_20 | AC | 117 ms
80,516 KB |
testcase_21 | AC | 117 ms
83,432 KB |
testcase_22 | AC | 124 ms
80,660 KB |
testcase_23 | AC | 106 ms
83,632 KB |
testcase_24 | AC | 78 ms
79,064 KB |
testcase_25 | AC | 87 ms
78,468 KB |
testcase_26 | AC | 130 ms
84,012 KB |
testcase_27 | AC | 120 ms
79,000 KB |
testcase_28 | AC | 124 ms
95,168 KB |
testcase_29 | AC | 144 ms
105,100 KB |
testcase_30 | AC | 173 ms
105,560 KB |
testcase_31 | AC | 165 ms
98,256 KB |
testcase_32 | AC | 199 ms
115,108 KB |
testcase_33 | AC | 280 ms
115,400 KB |
testcase_34 | AC | 188 ms
100,864 KB |
testcase_35 | AC | 181 ms
96,660 KB |
testcase_36 | AC | 234 ms
121,032 KB |
testcase_37 | AC | 364 ms
123,040 KB |
testcase_38 | AC | 254 ms
118,568 KB |
testcase_39 | AC | 271 ms
123,392 KB |
testcase_40 | AC | 360 ms
122,600 KB |
testcase_41 | AC | 210 ms
118,436 KB |
testcase_42 | AC | 270 ms
120,512 KB |
testcase_43 | AC | 256 ms
119,068 KB |
ソースコード
H, W = map(int, input().split()) S = [input() for _ in range(H)] mx1 = [[0]*(W+2) for _ in range(H+2)] mx2 = [[0]*(W+2) for _ in range(H+2)] mx3 = [[0]*(W+2) for _ in range(H+2)] mx4 = [[0]*(W+2) for _ in range(H+2)] for i in range(H): for j in range(W): if S[i][j] == '#': mx1[i][j] = mx1[i-1][j-1] + 1 for i in range(H): for j in range(W): if S[i][j] == '#': mx2[i][j] = mx2[i-1][j+1] + 1 for i in range(H-1,-1,-1): for j in range(W): if S[i][j] == '#': mx3[i][j] = mx3[i+1][j-1] + 1 for i in range(H-1,-1,-1): for j in range(W): if S[i][j] == '#': mx4[i][j] = mx4[i+1][j+1] + 1 imos1 = [[0]*(W+2) for _ in range(H+2)] imos2 = [[0]*(W+2) for _ in range(H+2)] for i in range(H): for j in range(W): r = min(mx1[i][j], mx2[i][j], mx3[i][j], mx4[i][j]) - 1 if r <= 0: continue imos1[i - r][j - r]+=1 imos1[i + r + 1][j + r + 1]-=1 imos2[i - r][j + r]+=1 imos2[i + r + 1][j - r - 1]-=1 for i in range(H): for j in range(W): imos1[i][j] += imos1[i - 1][j - 1] imos2[i][j] += imos2[i - 1][j + 1] same = True for i in range(H): for j in range(W): if S[i][j] == '#' and imos1[i][j] + imos2[i][j] == 0: same = False print("Yes" if same else "No")