結果

問題 No.2443 特殊線形群の標準表現
ユーザー hiro1729hiro1729
提出日時 2023-08-27 18:49:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 847 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 818,316 KB
最終ジャッジ日時 2023-08-27 18:50:08
合計ジャッジ時間 8,802 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,192 KB
testcase_01 AC 15 ms
7,872 KB
testcase_02 AC 15 ms
8,252 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 15 ms
8,288 KB
testcase_10 AC 15 ms
8,248 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 MLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, md, q = map(int, input().split())
a = [[list(map(int, input().split())), list(map(int, input().split()))] for _ in range(n)]
# 後ろから累積積を取る
# 0>E
# 1>N-1
# 2>(N-1)*(N-2)
b = [[[1, 0], [0, 1]]]
for i in a[::-1]:
	# b[-1]*iを末尾に追加
	b.append([[b[-1][0][0] * i[0][0] + b[-1][0][1] * i[1][0], b[-1][0][0] * i[0][1] + b[-1][0][1] * i[1][1]], [b[-1][1][0] * i[0][0] + b[-1][1][1] * i[1][0], b[-1][1][0] * i[0][1] + b[-1][1][1] * i[1][1]]])
b.append(b[-1])
for _ in range(q):
	l, r, x, y = map(int, input().split())
	p = b[n - r]
	q = b[n - l + 1]
	# p^-1*qを求める
	# pの行列式は1
	c = p[1][1]
	d = -p[0][1]
	e = -p[1][0]
	f = p[0][0]
	g = q[0][0]
	h = q[0][1]
	i = q[1][0]
	j = q[1][1]
	s = c * g + d * i
	t = c * h + d * j
	u = e * g + f * i
	v = e * h + f * j
	print((s * x + t * y) % md, (u * x + v * y) % md)
0