結果

問題 No.455 冬の大三角
ユーザー yumechi
提出日時 2016-12-07 17:32:06
言語 PyPy3
(6.0.0)
結果
WA   .
(最新)
AC  
(最初)
実行時間 -
コード長 1,161 Byte
コンパイル時間 8,834 ms
使用メモリ 53,692 KB
最終ジャッジ日時 2018-07-24 04:09:45

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
0_sample1.txt AC 99 ms
53,672 KB
0_sample2.txt AC 99 ms
53,680 KB
0_sample3.txt AC 98 ms
53,684 KB
1_hand1.txt AC 98 ms
53,680 KB
1_hand2.txt AC 99 ms
53,680 KB
1_hand3.txt AC 97 ms
53,684 KB
1_hand4.txt AC 99 ms
53,680 KB
1_hand5.txt AC 99 ms
53,688 KB
1_hand6.txt AC 103 ms
53,692 KB
2_small1.txt AC 101 ms
53,680 KB
2_small2.txt AC 99 ms
53,684 KB
2_small3.txt AC 99 ms
53,684 KB
2_small4.txt AC 98 ms
53,688 KB
2_small5.txt AC 98 ms
53,680 KB
2_small6.txt AC 97 ms
53,684 KB
2_small7.txt AC 97 ms
53,684 KB
2_small8.txt AC 97 ms
53,680 KB
2_small9.txt AC 97 ms
53,684 KB
2_small10.txt AC 96 ms
53,680 KB
2_small11.txt AC 98 ms
53,684 KB
2_small12.txt AC 98 ms
53,680 KB
2_small13.txt AC 100 ms
53,684 KB
2_small14.txt AC 100 ms
53,676 KB
2_small15.txt AC 100 ms
53,688 KB
2_small16.txt AC 101 ms
53,688 KB
2_small17.txt AC 102 ms
53,684 KB
2_small18.txt AC 100 ms
53,684 KB
2_small19.txt AC 97 ms
53,680 KB
2_small20.txt AC 98 ms
53,680 KB
3_test1.txt AC 99 ms
53,680 KB
3_test2.txt AC 99 ms
53,680 KB
3_test3.txt AC 100 ms
53,680 KB
3_test4.txt AC 98 ms
53,680 KB
3_test5.txt AC 100 ms
53,688 KB
3_test6.txt AC 98 ms
53,680 KB
3_test7.txt AC 100 ms
53,684 KB
3_test8.txt AC 99 ms
53,688 KB
3_test9.txt AC 98 ms
53,680 KB
3_test10.txt AC 99 ms
53,684 KB
3_test11.txt AC 101 ms
53,684 KB
3_test12.txt AC 103 ms
53,688 KB
3_test13.txt AC 102 ms
53,688 KB
3_test14.txt AC 100 ms
53,684 KB
3_test15.txt AC 100 ms
53,688 KB
3_test16.txt AC 99 ms
53,680 KB
3_test17.txt AC 97 ms
53,688 KB
3_test18.txt AC 99 ms
53,676 KB
3_test19.txt AC 100 ms
53,680 KB
3_test20.txt AC 98 ms
53,684 KB
99_challenge01.txt AC 97 ms
53,676 KB
99_system_test1.txt AC 96 ms
53,680 KB
99_system_test2.txt AC 95 ms
53,680 KB
system_test1.txt AC 97 ms
53,684 KB
system_test2.txt WA -
system_test3.txt AC 99 ms
53,680 KB
system_test4.txt AC 100 ms
53,680 KB
system_test5.txt AC 103 ms
53,684 KB
テストケース一括ダウンロード

ソースコード

diff #
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()
0