結果

問題 No.675 ドットちゃんたち
コンテスト
ユーザー H3PO4
提出日時 2024-04-12 14:10:11
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,389 ms / 2,000 ms
+ 147µs
コード長 578 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 298 ms
コンパイル使用メモリ 21,280 KB
実行使用メモリ 62,744 KB
最終ジャッジ日時 2026-07-21 08:41:13
合計ジャッジ時間 16,061 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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