結果
問題 | No.2641 draw X |
ユーザー | ニックネーム |
提出日時 | 2024-02-20 00:04:38 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 2,262 bytes |
コンパイル時間 | 307 ms |
コンパイル使用メモリ | 82,340 KB |
実行使用メモリ | 228,280 KB |
最終ジャッジ日時 | 2024-09-29 03:17:24 |
合計ジャッジ時間 | 19,883 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
52,992 KB |
testcase_01 | AC | 39 ms
53,120 KB |
testcase_02 | AC | 40 ms
53,932 KB |
testcase_03 | AC | 38 ms
53,160 KB |
testcase_04 | AC | 40 ms
53,308 KB |
testcase_05 | AC | 39 ms
53,728 KB |
testcase_06 | AC | 39 ms
54,624 KB |
testcase_07 | AC | 38 ms
53,080 KB |
testcase_08 | AC | 38 ms
52,996 KB |
testcase_09 | AC | 39 ms
53,488 KB |
testcase_10 | AC | 39 ms
53,304 KB |
testcase_11 | AC | 40 ms
53,840 KB |
testcase_12 | AC | 41 ms
54,576 KB |
testcase_13 | AC | 39 ms
53,248 KB |
testcase_14 | AC | 40 ms
53,988 KB |
testcase_15 | AC | 463 ms
215,380 KB |
testcase_16 | AC | 1,320 ms
228,280 KB |
testcase_17 | AC | 39 ms
53,304 KB |
testcase_18 | AC | 38 ms
52,884 KB |
testcase_19 | AC | 41 ms
53,524 KB |
testcase_20 | AC | 211 ms
86,804 KB |
testcase_21 | AC | 252 ms
99,908 KB |
testcase_22 | AC | 213 ms
86,184 KB |
testcase_23 | AC | 222 ms
95,864 KB |
testcase_24 | AC | 142 ms
85,344 KB |
testcase_25 | AC | 152 ms
83,672 KB |
testcase_26 | AC | 286 ms
100,592 KB |
testcase_27 | AC | 185 ms
82,804 KB |
testcase_28 | AC | 313 ms
125,976 KB |
testcase_29 | AC | 444 ms
191,108 KB |
testcase_30 | AC | 469 ms
172,156 KB |
testcase_31 | AC | 439 ms
141,028 KB |
testcase_32 | AC | 602 ms
190,664 KB |
testcase_33 | AC | 1,041 ms
190,376 KB |
testcase_34 | AC | 515 ms
143,332 KB |
testcase_35 | AC | 614 ms
135,104 KB |
testcase_36 | AC | 789 ms
212,704 KB |
testcase_37 | TLE | - |
testcase_38 | AC | 965 ms
206,188 KB |
testcase_39 | AC | 1,014 ms
226,100 KB |
testcase_40 | AC | 1,785 ms
218,664 KB |
testcase_41 | AC | 754 ms
206,636 KB |
testcase_42 | AC | 1,077 ms
211,720 KB |
testcase_43 | AC | 1,061 ms
208,288 KB |
ソースコード
h,w = map(int,input().split()); s = [] for _ in range(h): s += [v=="#" for v in input()] lurd = s[:] for i in range(h-1): for j in range(w-1): lurd[w*(i+1)+(j+1)] += lurd[w*i+j] rdlu = s[:] for i in range(h-1,0,-1): for j in range(w-1,0,-1): rdlu[w*(i-1)+(j-1)] += rdlu[w*i+j] ruld = s[:] for i in range(h-1): for j in range(w-1,0,-1): ruld[w*(i+1)+(j-1)] += ruld[w*i+j] ldru = s[:] for i in range(h-1,0,-1): for j in range(w-1): ldru[w*(i-1)+(j+1)] += ldru[w*i+j] p1 = [0]*(h+1)*(w+1) p2 = [0]*(h+1)*(w+1) p3 = [0]*(h+1)*(w+1) p4 = [0]*(h+1)*(w+1) for i in range(1,h-1): for j in range(1,w-1): if s[w*i+j]==0: continue ac1 = 0; wa = min(h-i,w-j) while wa-ac1>1: wj = (ac1+wa)//2 if lurd[w*(i+wj)+(j+wj)]-lurd[w*i+j]==wj: ac1 = wj else: wa = wj ac2 = 0; wa = min(i+1,j+1,ac1+1) while wa-ac2>1: wj = (ac2+wa)//2 if rdlu[w*(i-wj)+(j-wj)]-rdlu[w*i+j]==wj: ac2 = wj else: wa = wj ac3 = 0; wa = min(h-i,j+1,ac2+1) while wa-ac3>1: wj = (ac3+wa)//2 if ruld[w*(i+wj)+(j-wj)]-ruld[w*i+j]==wj: ac3 = wj else: wa = wj ac4 = 0; wa = min(i+1,w-j,ac3+1) while wa-ac4>1: wj = (ac4+wa)//2 if ldru[w*(i-wj)+(j+wj)]-ldru[w*i+j]==wj: ac4 = wj else: wa = wj m = ac4 if m==0: continue p1[(w+1)*i+j] += 1; p1[(w+1)*(i+m+1)+(j+m+1)] -= 1 p2[(w+1)*i+j] += 1; p2[(w+1)*(i-m-1)+(j-m-1)] -= 1 p3[(w+1)*i+j] += 1; p3[(w+1)*(i+m+1)+(j-m-1)] -= 1 p4[(w+1)*i+j] += 1; p4[(w+1)*(i-m-1)+(j+m+1)] -= 1 t = [False]*h*w for i in range(h): for j in range(w): t[w*i+j] |= p1[(w+1)*i+j]>0 p1[(w+1)*(i+1)+(j+1)] += p1[(w+1)*i+j] for i in range(h-1,-1,-1): for j in range(w-1,-1,-1): t[w*i+j] |= p2[(w+1)*i+j]>0 p2[(w+1)*(i-1)+(j-1)] += p2[(w+1)*i+j] for i in range(h): for j in range(w-1,-1,-1): t[w*i+j] |= p3[(w+1)*i+j]>0 p3[(w+1)*(i+1)+(j-1)] += p3[(w+1)*i+j] for i in range(h-1,-1,-1): for j in range(w): t[w*i+j] |= p4[(w+1)*i+j]>0 p4[(w+1)*(i-1)+(j+1)] += p4[(w+1)*i+j] print("Yes" if s==t else "No")