File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -151,10 +151,10 @@ namespace cp_algo::linalg {
151
151
}
152
152
153
153
size_t rank () const {
154
- if (n () < m ()) {
154
+ if (n () > m ()) {
155
155
return T ().rank ();
156
156
}
157
- return size (matrix (*this ).gauss ()[0 ]);
157
+ return size (matrix (*this ).echelonize ()[0 ]);
158
158
}
159
159
160
160
base det () const {
Original file line number Diff line number Diff line change
1
+ // @brief Rank of Matrix
2
+ #define PROBLEM " https://judge.yosupo.jp/problem/matrix_rank"
3
+ #pragma GCC optimize("Ofast,unroll-loops")
4
+ #pragma GCC target("avx2,tune=native")
5
+ #include " cp-algo/linalg/matrix.hpp"
6
+ #include < bits/stdc++.h>
7
+
8
+ using namespace std ;
9
+ using namespace cp_algo ::algebra;
10
+ using namespace cp_algo ::linalg;
11
+
12
+ const int mod = 998244353 ;
13
+ using base = modular<mod>;
14
+
15
+ void solve () {
16
+ int n, m;
17
+ cin >> n >> m;
18
+ matrix<base> A (n, m);
19
+ A.read ();
20
+ cout << A.rank () << " \n " ;
21
+ }
22
+
23
+ signed main () {
24
+ // freopen("input.txt", "r", stdin);
25
+ ios::sync_with_stdio (0 );
26
+ cin.tie (0 );
27
+ int t = 1 ;
28
+ // cin >> t;
29
+ while (t--) {
30
+ solve ();
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments