結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-07 17:32:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,161 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 53,376 KB |
| 最終ジャッジ日時 | 2024-06-11 14:52:20 |
| 合計ジャッジ時間 | 4,494 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 53 WA * 1 |
ソースコード
def solve():
w, h = map(int, input().split())
px, py, qx, qy = -1, -1, -1, -1
for y in range(w):
line = input()
while "*" in line:
idx = line.find("*")
if px == -1:
px, py = idx, y
else:
if len(line) == h:
qx, qy = idx, y
else:
qx, qy = idx + px + 1, y
line = line[idx+1:]
tx, ty = -1, -1
patternlist = [[px-1, px+1, qx-1, qx+1], [py-1, py+1, qy-1, qy+1]]
for j in range(4):
for k in range(4):
x, y = patternlist[0][j], patternlist[1][k]
if (0 <= x < h and 0 <= y < w) \
and (not(x == px and y == py)) and (not(x == qx and y == qy)) \
and not(px - x == py - y and qx - x == qy - y):
tx, ty = x, y
break
if tx != -1:
break
points = [[px, qx, tx], [py, qy, ty]]
ans = [list("-" * h) for _ in range(w)]
for i in range(3):
ans[points[1][i]][points[0][i]] = "*"
print("\n".join(["".join(line) for line in ans]))
if __name__=="__main__":
solve()