結果

問題 No.675 ドットちゃんたち
ユーザー cielciel
提出日時 2018-04-18 20:45:49
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 623 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 77,756 KB
実行使用メモリ 163,244 KB
最終ジャッジ日時 2023-09-09 11:26:44
合計ジャッジ時間 6,379 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
78,212 KB
testcase_01 AC 82 ms
78,028 KB
testcase_02 AC 81 ms
78,236 KB
testcase_03 AC 82 ms
78,032 KB
testcase_04 AC 83 ms
78,040 KB
testcase_05 AC 618 ms
163,244 KB
testcase_06 AC 604 ms
160,576 KB
testcase_07 AC 562 ms
152,840 KB
testcase_08 AC 611 ms
160,788 KB
testcase_09 AC 617 ms
160,132 KB
testcase_10 AC 612 ms
160,840 KB
testcase_11 AC 623 ms
161,372 KB
権限があれば一括ダウンロードができます

ソースコード

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

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