結果

問題 No.455 冬の大三角
ユーザー matrie
提出日時 2020-12-27 11:07:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-01 07:18:16
合計ジャッジ時間 3,583 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w=map(int,input().split())
a=['']*h
s=[]
for y in range(h):
	a[y]=input()
	x=a[y].find('*')
	if x<0:continue
	s.append([x,y])
	z=a[y][x+1:].find('*')
	if z<0:continue
	s.append([z+x+1,y])

x,y=0,0
if x==s[0][0]==s[1][0]: x+=1
elif y==s[0][1]==s[1][1]: y+=1
elif [x,y] in s: 
	if x+1<w:x+=1
	else:y+=1
elif s[0][1]*s[1][0]==s[0][0]*s[1][1]:
	if x+1<w:x+=1
	else:y+=1
	
a[y]=a[y][:x]+'*'+a[y][x+1:]
print(*a,sep='\n')
0