結果
問題 | No.455 冬の大三角 |
ユーザー | rpy3cpp |
提出日時 | 2017-03-26 15:59:55 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 1,177 bytes |
コンパイル時間 | 77 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-06-30 00:57:44 |
合計ジャッジ時間 | 3,852 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
10,880 KB |
testcase_01 | AC | 33 ms
10,752 KB |
testcase_02 | AC | 31 ms
10,880 KB |
testcase_03 | AC | 30 ms
11,008 KB |
testcase_04 | AC | 30 ms
10,880 KB |
testcase_05 | AC | 30 ms
10,752 KB |
testcase_06 | AC | 30 ms
10,752 KB |
testcase_07 | AC | 29 ms
10,752 KB |
testcase_08 | AC | 33 ms
10,880 KB |
testcase_09 | AC | 30 ms
10,752 KB |
testcase_10 | AC | 30 ms
10,880 KB |
testcase_11 | AC | 30 ms
10,880 KB |
testcase_12 | AC | 30 ms
11,008 KB |
testcase_13 | AC | 30 ms
10,880 KB |
testcase_14 | AC | 30 ms
10,752 KB |
testcase_15 | AC | 30 ms
10,880 KB |
testcase_16 | AC | 29 ms
10,880 KB |
testcase_17 | AC | 30 ms
10,752 KB |
testcase_18 | AC | 30 ms
10,752 KB |
testcase_19 | AC | 30 ms
10,752 KB |
testcase_20 | AC | 30 ms
10,752 KB |
testcase_21 | AC | 30 ms
10,880 KB |
testcase_22 | AC | 31 ms
10,880 KB |
testcase_23 | AC | 30 ms
10,880 KB |
testcase_24 | AC | 30 ms
10,880 KB |
testcase_25 | AC | 30 ms
10,880 KB |
testcase_26 | AC | 30 ms
10,880 KB |
testcase_27 | AC | 29 ms
10,752 KB |
testcase_28 | AC | 30 ms
10,752 KB |
testcase_29 | AC | 32 ms
10,880 KB |
testcase_30 | AC | 31 ms
10,752 KB |
testcase_31 | AC | 31 ms
10,880 KB |
testcase_32 | AC | 31 ms
10,752 KB |
testcase_33 | AC | 31 ms
10,880 KB |
testcase_34 | AC | 30 ms
10,880 KB |
testcase_35 | AC | 31 ms
10,880 KB |
testcase_36 | AC | 31 ms
10,880 KB |
testcase_37 | AC | 31 ms
10,752 KB |
testcase_38 | AC | 30 ms
10,880 KB |
testcase_39 | AC | 32 ms
10,880 KB |
testcase_40 | AC | 31 ms
10,752 KB |
testcase_41 | AC | 31 ms
10,880 KB |
testcase_42 | AC | 31 ms
10,752 KB |
testcase_43 | AC | 31 ms
10,880 KB |
testcase_44 | AC | 30 ms
10,880 KB |
testcase_45 | AC | 32 ms
10,752 KB |
testcase_46 | AC | 31 ms
10,752 KB |
testcase_47 | AC | 30 ms
10,752 KB |
testcase_48 | AC | 30 ms
11,008 KB |
testcase_49 | AC | 31 ms
10,752 KB |
testcase_50 | AC | 30 ms
10,752 KB |
testcase_51 | AC | 30 ms
10,880 KB |
testcase_52 | AC | 30 ms
10,880 KB |
testcase_53 | AC | 29 ms
10,752 KB |
testcase_54 | AC | 29 ms
10,752 KB |
testcase_55 | AC | 30 ms
10,752 KB |
testcase_56 | AC | 30 ms
10,752 KB |
ソースコード
def read_data(): H, W = map(int, input().split()) Ss = [input().rstrip() for h in range(H)] return H, W, Ss def solve(H, W, Ss): x1, y1, x2, y2 = get_star_pos(H, W, Ss) x3, y3 = put_star(H, W, x1, y1, x2, y2) print_stars(H, W, x1, y1, x2, y2, x3, y3) def get_star_pos(H, W, Ss): xys = [] for y, S in enumerate(Ss): for x, c in enumerate(S): if c == '*': xys.append(x) xys.append(y) return xys def print_stars(H, W, x1, y1, x2, y2, x3, y3): star_pos = [(x1, y1), (x2, y2), (x3, y3)] for h in range(H): row = [] for w in range(W): if (w, h) in star_pos: row.append('*') else: row.append('-') print(''.join(row)) def put_star(H, W, x1, y1, x2, y2): for x in range(W): for y in range(H): if is_valid(x1, y1, x2, y2, x, y): return x, y raise RuntimeError("Couldn't find star pos.") def is_valid(x1, y1, x2, y2, x3, y3): x1 = x1 - x3 x2 = x2 - x3 y1 = y1 - y3 y2 = y2 - y3 return x1 * y2 != x2 * y1 H, W, Ss = read_data() solve(H, W, Ss)