結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 529 ms
43,856 KB
testcase_01 AC 574 ms
43,860 KB
testcase_02 AC 529 ms
43,864 KB
testcase_03 AC 563 ms
44,032 KB
testcase_04 AC 531 ms
44,504 KB
testcase_05 AC 1,782 ms
63,564 KB
testcase_06 AC 1,912 ms
68,312 KB
testcase_07 AC 1,723 ms
63,176 KB
testcase_08 AC 1,835 ms
64,464 KB
testcase_09 AC 1,945 ms
66,012 KB
testcase_10 AC 1,841 ms
67,792 KB
testcase_11 AC 1,857 ms
65,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, Px, Py = map(int, input().split())
matrices = []
matrix = np.diag(np.ones(3, dtype=np.int64))
x0 = np.array([Px, Py, 1], dtype=np.int64)

C = [tuple(map(int, input().split())) for _ in range(N)]
for cmd in reversed(C):
    if cmd[0] == 1:
        matr_x = np.array([[1, 0, 0], [0, 1, 0], [cmd[1], 0, 1]], dtype=np.int64)
        matrix = matr_x @ matrix
    elif cmd[0] == 2:
        matr_y = np.array([[1, 0, 0], [0, 1, 0], [0, cmd[1], 1]], dtype=np.int64)
        matrix = matr_y @ matrix
    elif cmd[0] == 3:
        matr_r = np.array([[0, -1, 0], [1, 0, 0], [0, 0, 1]], dtype=np.int64)
        matrix = matr_r @ matrix

    matrices.append(matrix)

for matrix in reversed(matrices):
    x, y, _ = x0 @ matrix
    print(x, y)
0