結果

問題 No.675 ドットちゃんたち
ユーザー ciel
提出日時 2018-04-18 20:45:10
言語 PyPy2
(7.3.15)
結果
RE  
実行時間 -
コード長 684 bytes
コンパイル時間 1,398 ms
コンパイル使用メモリ 76,336 KB
実行使用メモリ 76,936 KB
最終ジャッジ日時 2024-06-27 04:33:50
合計ジャッジ時間 3,289 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
import copy,math
try:
	import numpy
	def mul(a,b):
		return numpy.array(a).dot(b)
except ImportError:
	def mul(a,b):
		assert len(a[0])==len(b)
		r=[[0]*len(b[0]) for _ in a]
		for i in range(len(a)):
			for j in range(len(b[0])):
				for k in range(len(a[0])):
					r[i][j]+=a[i][k]*b[k][j]
		return r

from numpy import*
n,x,y=map(int,raw_input().split())
a=[[[1,0,c[1]],[0,1,0],[0,0,1]] if c[0]==1 else [[1,0,0],[0,1,c[1]],[0,0,1]] if c[0]==2 else [[0,1,0],[-1,0,0],[0,0,1]] for c in [map(int,raw_input().split()) for _ in range(n)]]
for i in range(n-2,-1,-1): a[i]=mul(a[i+1],a[i])
for i in range(n): print ' '.join(map(str,zip(*mul(a[i],[[x],[y],[1]]))[0][:2]))
0