結果

問題 No.455 冬の大三角
ユーザー maspy
提出日時 2020-01-07 21:44:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 566 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,616 KB
最終ジャッジ日時 2024-11-23 01:13:21
合計ジャッジ時間 34,163 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np
import random

H,W = map(int,readline().split())
S = np.frombuffer(read(),'S1').reshape(H,-1)[:,:W].astype(str)

X,Y = np.where(S == '*')

def test(x,y):
    x0,x1 = X-x
    y0,y1 = Y-y
    return x0 * y1 != y0 * x1

while True:
    x = random.randint(0,H-1)
    y = random.randint(0,W-1)
    if test(x,y):
        break

S[x][y] = '*'

print('\n'.join(''.join(row) for row in S))
0