結果

問題 No.675 ドットちゃんたち
ユーザー cielciel
提出日時 2018-09-11 00:56:02
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 666 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 65,544 KB
最終ジャッジ日時 2023-09-02 08:14:00
合計ジャッジ時間 16,378 ms
ジャッジサーバーID
(参考情報)
judge13 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,088 KB
testcase_01 AC 13 ms
6,196 KB
testcase_02 AC 13 ms
6,188 KB
testcase_03 AC 13 ms
6,188 KB
testcase_04 AC 13 ms
6,176 KB
testcase_05 AC 1,986 ms
62,968 KB
testcase_06 TLE -
testcase_07 AC 1,847 ms
59,156 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
権限があれば一括ダウンロードができます

ソースコード

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