結果
問題 | No.2443 特殊線形群の標準表現 |
ユーザー | MasKoaTS |
提出日時 | 2023-08-10 16:14:36 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,085 bytes |
コンパイル時間 | 4,860 ms |
コンパイル使用メモリ | 276,072 KB |
実行使用メモリ | 64,256 KB |
最終ジャッジ日時 | 2024-04-28 09:28:59 |
合計ジャッジ時間 | 12,443 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 2 ms
5,376 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 | WA | - |
ソースコード
#include <math.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define print(n) cout << (n) << endl #define fprint(n) cout << setprecision(16) << (n) << endl #define ceil_div(a, b) (((a) - 1) / (b) + 1) #define rep(i, l, n) for (int i = (l); i < (n); i++) #define itrep(itr, st) for (auto itr = st.begin(); itr != st.end(); itr++) #define ite(i, a) for (auto& i : a) #define last(v) v[v.size() - 1] #define all(x) x.begin(), x.end() #define lb(A, x) (lower_bound(all(A), x) - A.begin()) #define ub(A, x) (upper_bound(all(A), x) - A.begin()) #define INF 4611686018427387903ll #define inf 2147483647 #define mod 1000000007ll #define MOD 998244353ll using str = string; using ll = long long; using u32 = unsigned int; using u64 = unsigned long long; using Pair = pair<int, int>; using mint = modint1000000007; using Mint = modint998244353; template <class T> using V = vector<T>; template <class T> using VV = V<V<T> >; template <class T> using PQ = priority_queue<T, V<T>, greater<T> >; template <class T> using PQR = priority_queue<T>; template <class T> using BIT = fenwick_tree<T>; template <class T> inline V<T> getList(int n) { V<T> res(n); rep(i, 0, n) { cin >> res[i]; }return res; } template <class T> inline VV<T> getGrid(int m, int n) { VV<T> res(m, V<T>(n)); rep(i, 0, m) { res[i] = getList<T>(n); }return res; } template <class T> inline void prints(V<T>& vec) { if (vec.size() == 0)return; cout << vec[0]; rep(i, 1, vec.size()) { cout << ' ' << vec[i]; } cout << '\n'; } template<class T> inline vector<tuple<size_t, T> > enumerate(const vector<T>& values) { auto length = values.size(); auto values_with_indices = vector<tuple<size_t, T>>(length); for (size_t i = 0; i < length; ++i) { values_with_indices[i] = make_tuple(i, values[i]); } return values_with_indices; } inline V<int> dtois(string& s) { V<int> vec = {}; ite(e, s) { vec.push_back(e - '0'); } return vec; } inline V<int> atois(string& s) { V<int> vec = {}; ite(e, s) { vec.push_back(e - 'a'); } return vec; } inline V<int> Atois(string& s) { V<int> vec = {}; ite(e, s) { vec.push_back(e - 'A'); } return vec; } using Mat22 = VV<ll>; ll m; Mat22 seg_func(Mat22 B, Mat22 A){ Mat22 ret = {{0,0},{0,0}}; rep(i,0,2){ rep(j,0,2){ rep(k,0,2){ ret[i][j] += A[i][k] * B[k][j]; ret[i][j] %= m; } } } return ret; } Mat22 ide_ele(void){ Mat22 ret = {{1,0},{0,1}}; return ret; } int main(void) { int n, b, q; cin >> n >> b >> q; m = b; V<Mat22> A(n, Mat22({})); rep(i,0,n){ A[i] = getGrid<ll>(2, 2); } VV<ll> query = getGrid<ll>(q, 4); segtree<Mat22, seg_func, ide_ele> seg(A); for(V<ll>& qu : query){ ll l = qu[0], r = qu[1], x = qu[2], y = qu[3]; Mat22 P = seg.prod(l, r); V<ll> vec = {x, y}, ans = {0, 0}; rep(i,0,2){ rep(j,0,2){ ans[i] += P[i][j] * vec[j]; ans[i] %= m; } } prints(ans); } return 0; }