結果

問題 No.2443 特殊線形群の標準表現
ユーザー グミグミ
提出日時 2023-08-25 22:53:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 808 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 289,732 KB
最終ジャッジ日時 2023-08-25 22:54:01
合計ジャッジ時間 9,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
33,796 KB
testcase_01 AC 114 ms
29,516 KB
testcase_02 AC 110 ms
29,444 KB
testcase_03 AC 130 ms
29,428 KB
testcase_04 AC 113 ms
29,484 KB
testcase_05 AC 114 ms
29,408 KB
testcase_06 AC 110 ms
29,504 KB
testcase_07 AC 110 ms
29,416 KB
testcase_08 AC 114 ms
29,376 KB
testcase_09 AC 112 ms
29,492 KB
testcase_10 AC 117 ms
29,508 KB
testcase_11 AC 114 ms
29,492 KB
testcase_12 AC 131 ms
29,668 KB
testcase_13 AC 190 ms
32,180 KB
testcase_14 AC 872 ms
58,456 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
def main():
	n,b,q=map(int,input().split())
	arr = []
	inv_arr = []
	for _ in range(n):
		a11,a12=map(int,input().split())
		a21,a22=map(int,input().split())
		a = np.matrix([[a11,a12],[a21,a22]])
		arr.append(a)
		inv_a = np.matrix([[a22,-a12],[-a21,a11]])
		inv_arr.append(inv_a)
	
	mod_b = lambda x: x % b

	acc = [np.eye(2, dtype=int)]
	inv_acc = [np.eye(2, dtype=int)]
	for i in range(n):
		a = arr[i] * acc[-1]
		a = mod_b(a)
		acc.append(a)
		
		inv_a = inv_acc[-1] * inv_arr[i]
		inv_a = mod_b(inv_a)
		inv_acc.append(inv_a)

	for _ in range(q):
		l,r,x,y=map(int,input().split())
		a1 = acc[r]
		inv_a2 = inv_acc[l]
		a = a1 * inv_a2
		a = mod_b(a)
		zw = a * np.matrix([[x],[y]])
		z = zw[0,0]
		w = zw[1,0]
		
		z = z%b
		w = w%b
		print(z,w)

if __name__ == "__main__":
	main()
0