結果
問題 | No.2443 特殊線形群の標準表現 |
ユーザー | MasKoaTS |
提出日時 | 2023-08-09 23:29:30 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,514 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 159,108 KB |
最終ジャッジ日時 | 2024-11-15 21:54:14 |
合計ジャッジ時間 | 8,668 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
86,336 KB |
testcase_01 | AC | 130 ms
86,144 KB |
testcase_02 | AC | 126 ms
86,356 KB |
testcase_03 | AC | 127 ms
86,400 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 123 ms
86,272 KB |
testcase_10 | AC | 127 ms
86,272 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 618 ms
159,108 KB |
ソースコード
import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from functools import cmp_to_key import math import sys #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10 ** 6) inp = sys.stdin.readline input = lambda : inp()[:-1] getN = lambda : int(inp()) getNs = lambda : map(int, inp().split()) getList = lambda :list(map(int, inp().split())) getStrs = lambda n : [input() for _ in [0] * n] def yexit(): print("Yes"); exit(0) def nexit(): print("No"); exit(0) pi = 3.141592653589793 mod = 1000000007 MOD = 998244353 INF = 4611686018427387903 dx = [1, 0, -1, 0]; dy = [0, 1, 0, -1] #di = coll.defaultdict(int) """ Main Code """ n, b, q = getNs() As = [[getList() for _ in [0] * 2] for _ in [0] * n] query = [getList() for _ in [0] * q] def prod(A, B): ret = [[0, 0], [0, 0]] for i in range(2): for j in range(2): for k in range(2): ret[i][j] += A[i][k] * B[k][j] ret[i][j] %= b return ret A_prod = [[1, 0], [0, 1]] Bs = [A_prod] for A in As: A_prod = prod(A, A_prod) Bs.append(A_prod) def inverse(A): return [[A[1][1], -A[0][1]], [-A[1][0], A[0][0]]] def prod_vector(A, vec): ret = [0, 0] for i in range(2): for j in range(2): ret[i] += A[i][j] * vec[j] ret[i] %= b return ret for l, r, x, y in query: vec = [x, y] ans = prod_vector(prod(Bs[r], Bs[l]), vec) print(*ans)