結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
tookunn_1213
|
| 提出日時 | 2017-09-24 10:09:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 670 bytes |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-06-30 03:13:24 |
| 合計ジャッジ時間 | 3,821 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
ソースコード
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
p = []
for i in range(H):
for j in range(W):
if S[i][j] == '*':
p.append((i,j))
ok = [[True for j in range(W)] for i in range(H)]
ok[p[0][0]][p[0][1]] = False
ok[p[1][0]][p[1][1]] = False
dy,dx = [0,1,0,-1],[1,0,-1,0]
flag = False
ansi,ansj = -1,-1
for pp in p:
for i in range(4):
ny,nx = pp[0] + dy[i],pp[1] + dx[i]
if ny < H and nx < W and ny >= 0 and nx >= 0:
if not ok[ny][nx]:
continue
if not (p[0][0] == p[1][0] == ny or p[0][1] == p[1][1] == nx):
ansi,ansj = ny,nx
flag = True
break
if flag:
break
S[ansi][ansj] = '*'
for i in range(H):
print(''.join(S[i]))
tookunn_1213