結果

問題 No.675 ドットちゃんたち
ユーザー H3PO4H3PO4
提出日時 2024-04-12 14:10:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,739 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 68,172 KB
最終ジャッジ日時 2024-04-12 14:10:33
合計ジャッジ時間 18,553 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 430 ms
44,096 KB
testcase_01 AC 450 ms
44,104 KB
testcase_02 AC 480 ms
43,964 KB
testcase_03 AC 433 ms
44,348 KB
testcase_04 AC 445 ms
44,232 KB
testcase_05 AC 1,732 ms
63,888 KB
testcase_06 AC 1,731 ms
67,904 KB
testcase_07 AC 1,583 ms
63,296 KB
testcase_08 AC 1,648 ms
63,936 KB
testcase_09 AC 1,739 ms
65,992 KB
testcase_10 AC 1,704 ms
68,172 KB
testcase_11 AC 1,683 ms
65,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, Px, Py = map(int, input().split())
matrices = []
matrix = np.diag([1] * 3)

C = [tuple(map(int, input().split())) for _ in range(N)]
for cmd in reversed(C):
    if cmd[0] == 1:
        matrix = np.dot([[1, 0, 0], [0, 1, 0], [cmd[1], 0, 1]], matrix)
    elif cmd[0] == 2:
        matrix = np.dot([[1, 0, 0], [0, 1, 0], [0, cmd[1], 1]], matrix)
    elif cmd[0] == 3:
        matrix = np.dot([[0, -1, 0], [1, 0, 0], [0, 0, 1]], matrix)

    matrices.append(matrix)
for matrix in reversed(matrices):
    x, y = np.dot([Px, Py, 1], matrix)[:2]
    print(x, y)
0