algo — C++23 日本語リファレンス GitHub

test/yosupo/matrix/determinant_of_matrix.test.cpp

AC · 最終更新 2026-09-07 · GitHub

問題: https://judge.yosupo.jp/problem/matrix_det

依存するヘッダ(4)
実装
// competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/matrix_det
#include <iostream>
#include <vector>
#include "linalg/matrix.hpp"
#include "number_theory/modint.hpp"

using Mint = modint998;

int main(void) {
    int n;
    std::cin >> n;
    std::vector<std::vector<Mint>> v(n, std::vector<Mint>(n));
    for (auto &u : v) {
        for (auto &e : u) std::cin >> e;
    }
    Matrix mat(v);
    std::cout << mat.det() << '\n';

    return 0;
}