File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
linear_algebra_matrix/test Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ #define PROBLEM " https://judge.yosupo.jp/problem/matrix_det"
2+ #include " ../../modint.hpp"
3+ #include " ../matrix.hpp"
4+ #include < iostream>
5+ using namespace std ;
6+
7+ int main () {
8+ cin.tie (nullptr );
9+ ios::sync_with_stdio (false );
10+
11+ int N;
12+ cin >> N;
13+ matrix<ModInt<998244353 >> M (N, N);
14+ cin >> M;
15+ cout << M.gauss_jordan ().determinant_of_upper_triangle () << ' \n ' ;
16+ }
Original file line number Diff line number Diff line change 1+ #define PROBLEM " https://judge.yosupo.jp/problem/pow_of_matrix"
2+ #include " ../../modint.hpp"
3+ #include " ../matrix.hpp"
4+ #include < iostream>
5+ using namespace std ;
6+
7+ int main () {
8+ cin.tie (nullptr );
9+ ios::sync_with_stdio (false );
10+
11+ int N;
12+ long long K;
13+ cin >> N >> K;
14+ matrix<ModInt<998244353 >> M (N, N);
15+ cin >> M;
16+ M = M.pow (K);
17+ for (int i = 0 ; i < N; ++i) {
18+ cout << M[i][0 ];
19+ for (int j = 1 ; j < N; ++j) cout << ' ' << M[i][j];
20+ cout << ' \n ' ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ #define PROBLEM " https://judge.yosupo.jp/problem/matrix_rank"
2+ #include " ../../modint.hpp"
3+ #include " ../matrix.hpp"
4+ #include < iostream>
5+ using namespace std ;
6+
7+ int main () {
8+ cin.tie (nullptr );
9+ ios::sync_with_stdio (false );
10+
11+ int N, M;
12+ cin >> N >> M;
13+ matrix<ModInt<998244353 >> mat (N, M);
14+ cin >> mat;
15+ cout << mat.gauss_jordan ().rank_of_gauss_jordan () << ' \n ' ;
16+ }
You can’t perform that action at this time.
0 commit comments