結果

問題 No.2443 特殊線形群の標準表現
ユーザー cho435cho435
提出日時 2023-08-25 22:14:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,364 ms / 3,000 ms
コード長 954 bytes
コンパイル時間 4,643 ms
コンパイル使用メモリ 273,436 KB
実行使用メモリ 56,948 KB
最終ジャッジ日時 2023-08-25 22:15:02
合計ジャッジ時間 12,742 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 9 ms
4,376 KB
testcase_14 AC 100 ms
9,472 KB
testcase_15 AC 1,177 ms
56,928 KB
testcase_16 AC 1,168 ms
56,880 KB
testcase_17 AC 1,157 ms
56,824 KB
testcase_18 AC 1,132 ms
56,764 KB
testcase_19 AC 1,364 ms
56,948 KB
testcase_20 AC 832 ms
56,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;


int MOD;
using mat=vector<vector<ll>>;
mat op(mat a,mat b){
	mat rt(2,vector<ll>(2,0));
	rep(i,2){
		rep(k,2){
			rep(j,2){
				rt.at(i).at(j)=(rt.at(i).at(j)+a.at(i).at(k)*b.at(k).at(j))%MOD;
			}
		}
	}
	return rt;
}
mat e(){
	return {{1,0},{0,1}};
}

using seg = atcoder::segtree<mat,op,e>;

int main(){
	int n,b,q;
	cin>>n>>b>>q;
	MOD=b;
	vector<mat> a(n,mat(2,vector<ll>(2)));
	rep(i,n){
		for(auto &v:a.at(i)){
			for(auto &x:v){
				cin>>x;
				x=(x%MOD+MOD)%MOD;
			}
		}
	}
	reverse(a.begin(),a.end());
	seg sg(a);
	rep(lp,q){
		int l,r,x,y;
		cin>>l>>r>>x>>y;
		l=n-l,r=n-r;
		x=(x%MOD+MOD)%MOD,y=(y%MOD+MOD)%MOD;
		mat vv=sg.prod(r,l);
		cout<<((vv.at(0).at(0)*x)%MOD+(vv.at(0).at(1)*y)%MOD)%MOD<<" "<<((vv.at(1).at(0)*x)%MOD+(vv.at(1).at(1)*y)%MOD)%MOD<<endl;
	}
}
0