結果
| 問題 | No.2445 奇行列式 |
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2023-08-26 08:31:05 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,223 bytes |
| コンパイル時間 | 7,083 ms |
| コンパイル使用メモリ | 315,976 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-12-25 02:02:39 |
| 合計ジャッジ時間 | 43,696 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 2 TLE * 9 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
using mint = atcoder::modint;
using M = vector<vector<__int128>>;
__int128 det(M a, int n, bool flg) {
if (n == 1) {
return a[0][0];
}
i64 ret = 0;
for (auto i : views::iota(0, n)) {
M sa;
for (auto j : views::iota(0, n-1)) {
sa.push_back(vector<__int128>());
int p = 0;
for (auto k : views::iota(0, n)) {
if (k == i) continue;
sa[j].push_back(a[j + 1][k]);
}
}
i64 f = flg && i % 2 ? -1 : 1;
ret += f * a[0][i] * det(sa, n - 1, flg);
}
return ret;
}
int main() {
FAST_IO
int n, b;
cin >> n >> b;
M a;
for (auto i : views::iota(0, n)) {
a.push_back(vector<__int128>());
for (auto j : views::iota(0, n)) {
long v;
cin >> v;
a[i].push_back(v);
}
}
auto x = det(a, n, true);
auto y = det(a, n, false);
auto ret = (long)((y-x)/2%b);
cout << ret << endl;
}
hiromi_ayase