結果
問題 | No.2641 draw X |
ユーザー | ニックネーム |
提出日時 | 2024-02-19 23:47:40 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,202 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 82,260 KB |
実行使用メモリ | 219,832 KB |
最終ジャッジ日時 | 2024-09-29 03:15:49 |
合計ジャッジ時間 | 16,637 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,760 KB |
testcase_01 | AC | 39 ms
53,664 KB |
testcase_02 | AC | 38 ms
53,356 KB |
testcase_03 | AC | 38 ms
54,072 KB |
testcase_04 | AC | 39 ms
53,004 KB |
testcase_05 | AC | 39 ms
54,468 KB |
testcase_06 | AC | 39 ms
53,608 KB |
testcase_07 | AC | 39 ms
54,584 KB |
testcase_08 | AC | 39 ms
53,448 KB |
testcase_09 | AC | 38 ms
54,072 KB |
testcase_10 | AC | 39 ms
53,548 KB |
testcase_11 | AC | 39 ms
53,356 KB |
testcase_12 | AC | 38 ms
53,216 KB |
testcase_13 | AC | 39 ms
53,260 KB |
testcase_14 | AC | 37 ms
53,404 KB |
testcase_15 | AC | 402 ms
218,992 KB |
testcase_16 | AC | 1,565 ms
219,832 KB |
testcase_17 | AC | 39 ms
53,076 KB |
testcase_18 | AC | 38 ms
53,292 KB |
testcase_19 | AC | 38 ms
53,804 KB |
testcase_20 | AC | 230 ms
87,324 KB |
testcase_21 | AC | 299 ms
99,200 KB |
testcase_22 | AC | 250 ms
86,884 KB |
testcase_23 | AC | 251 ms
96,248 KB |
testcase_24 | AC | 140 ms
84,644 KB |
testcase_25 | AC | 149 ms
83,604 KB |
testcase_26 | AC | 354 ms
99,788 KB |
testcase_27 | AC | 212 ms
83,388 KB |
testcase_28 | AC | 333 ms
125,596 KB |
testcase_29 | AC | 404 ms
181,400 KB |
testcase_30 | AC | 532 ms
169,296 KB |
testcase_31 | AC | 583 ms
135,044 KB |
testcase_32 | AC | 733 ms
187,456 KB |
testcase_33 | AC | 1,252 ms
181,532 KB |
testcase_34 | AC | 643 ms
139,852 KB |
testcase_35 | AC | 779 ms
132,564 KB |
testcase_36 | AC | 1,209 ms
204,784 KB |
testcase_37 | TLE | - |
testcase_38 | AC | 1,476 ms
198,140 KB |
testcase_39 | AC | 1,600 ms
217,948 KB |
testcase_40 | TLE | - |
testcase_41 | AC | 1,008 ms
198,944 KB |
testcase_42 | AC | 1,680 ms
204,520 KB |
testcase_43 | AC | 1,603 ms
200,236 KB |
ソースコード
h,w = map(int,input().split()) s = [[v=="#" for v in input()] for _ in range(h)] lurd = [t[:] for t in s] for i in range(h-1): for j in range(w-1): lurd[i+1][j+1] += lurd[i][j] rdlu = [t[:] for t in s] for i in range(h-1,0,-1): for j in range(w-1,0,-1): rdlu[i-1][j-1] += rdlu[i][j] ruld = [t[:] for t in s] for i in range(h-1): for j in range(w-1,0,-1): ruld[i+1][j-1] += ruld[i][j] ldru = [t[:] for t in s] for i in range(h-1,0,-1): for j in range(w-1): ldru[i-1][j+1] += ldru[i][j] p1 = [[0]*(w+1) for _ in range(h+1)] p2 = [[0]*(w+1) for _ in range(h+1)] p3 = [[0]*(w+1) for _ in range(h+1)] p4 = [[0]*(w+1) for _ in range(h+1)] for i in range(1,h-1): for j in range(1,w-1): if s[i][j]==0: continue ac1 = 0; wa = min(h-i,w-j) while wa-ac1>1: wj = (ac1+wa)//2 if lurd[i+wj][j+wj]-lurd[i][j]==wj: ac1 = wj else: wa = wj ac2 = 0; wa = min(i+1,j+1) while wa-ac2>1: wj = (ac2+wa)//2 if rdlu[i-wj][j-wj]-rdlu[i][j]==wj: ac2 = wj else: wa = wj ac3 = 0; wa = min(h-i,j+1) while wa-ac3>1: wj = (ac3+wa)//2 if ruld[i+wj][j-wj]-ruld[i][j]==wj: ac3 = wj else: wa = wj ac4 = 0; wa = min(i+1,w-j) while wa-ac4>1: wj = (ac4+wa)//2 if ldru[i-wj][j+wj]-ldru[i][j]==wj: ac4 = wj else: wa = wj m = min(ac1,ac2,ac3,ac4) if m==0: continue p1[i][j] += 1; p1[i+m+1][j+m+1] -= 1 p2[i][j] += 1; p2[i-m-1][j-m-1] -= 1 p3[i][j] += 1; p3[i+m+1][j-m-1] -= 1 p4[i][j] += 1; p4[i-m-1][j+m+1] -= 1 t = [[False]*w for _ in range(h)] for i in range(h): for j in range(w): t[i][j] |= p1[i][j]>0 p1[i+1][j+1] += p1[i][j] for i in range(h-1,-1,-1): for j in range(w-1,-1,-1): t[i][j] |= p2[i][j]>0 p2[i-1][j-1] += p2[i][j] for i in range(h): for j in range(w-1,-1,-1): t[i][j] |= p3[i][j]>0 p3[i+1][j-1] += p3[i][j] for i in range(h-1,-1,-1): for j in range(w): t[i][j] |= p4[i][j]>0 p4[i-1][j+1] += p4[i][j] print("Yes" if s==t else "No")