結果
問題 |
No.2443 特殊線形群の標準表現
|
ユーザー |
![]() |
提出日時 | 2023-08-25 21:52:14 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 891 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 139,956 KB |
最終ジャッジ日時 | 2024-12-24 08:33:57 |
合計ジャッジ時間 | 34,595 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 9 RE * 1 TLE * 6 |
ソースコード
import numpy as np n,b,q = list(map(int, input().split(' '))) mat_list = [] for i in range(n): c = list(map(int, input().split(' '))) d = list(map(int, input().split(' '))) # c = [x%b for x in c] # d = [x%b for x in c] mat_list.append(np.array([c,d])) # print(*mat_list) mat_sum = [] mat_sum.append(np.array([[1,0],[0,1]])) for i in range(n): tail = mat_sum[-1] next = np.matmul(mat_list[i],tail) next = [x%b for x in next] mat_sum.append(next) # print(*mat_sum) for _ in range(q): L,R,x,y = list(map(int, input().split(' '))) # print(L,R,x,y) total = mat_sum[R] # print(total) hosei = np.linalg.inv(mat_sum[L]) hosei = np.array(hosei,dtype='int64') # print(hosei) valid = np.matmul(hosei,total) # print(valid) target = np.array([x,y]) ans = np.matmul(valid,target) ans = [a%b for a in ans] print(*ans)