結果

問題 No.2444 一次変換と体積
ユーザー hiromi_ayasehiromi_ayase
提出日時 2023-08-25 23:50:42
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 834 bytes
コンパイル時間 6,383 ms
コンパイル使用メモリ 305,812 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 23:50:50
合計ジャッジ時間 6,807 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

int main() {
  FAST_IO

  int n, b;
  cin >> n >> b;
  mint::set_mod(b);

  i64 m[3][3];
  for (auto i : views::iota(0, 3)) {
    for (auto j : views::iota(0, 3)) {
      int x;
      cin >> x;
      m[i][j] = x;
    }
  }

  i64 det = 0;
  for (auto i : views::iota(0,3)){
    int j = (i + 1) % 3;
    int k = (i + 2) % 3;
    i64 cur = m[0][i] * (m[1][j] * m[2][k] - m[1][k] * m[2][j]);
    det += cur;
  }
  mint v = abs(det);

  cout << v.pow(n).val() << endl;
}
0