結果
問題 | No.1836 Max Matrix |
ユーザー | srjywrdnprkt |
提出日時 | 2023-05-24 01:02:50 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 864 bytes |
コンパイル時間 | 903 ms |
コンパイル使用メモリ | 103,944 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-24 22:47:03 |
合計ジャッジ時間 | 2,589 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 54 ms
4,376 KB |
testcase_03 | AC | 55 ms
4,380 KB |
testcase_04 | AC | 30 ms
4,376 KB |
testcase_05 | AC | 46 ms
4,380 KB |
testcase_06 | AC | 34 ms
4,376 KB |
testcase_07 | AC | 54 ms
4,376 KB |
testcase_08 | AC | 16 ms
4,376 KB |
testcase_09 | AC | 52 ms
4,376 KB |
testcase_10 | AC | 35 ms
4,376 KB |
testcase_11 | AC | 2 ms
4,376 KB |
testcase_12 | AC | 63 ms
4,376 KB |
testcase_13 | AC | 24 ms
4,376 KB |
testcase_14 | AC | 29 ms
4,376 KB |
testcase_15 | AC | 3 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <map> #include <set> #include <iomanip> #include <queue> #include <algorithm> #include <numeric> #include <deque> using namespace std; using ll = long long; const ll modc = 998244353; long long mod_exp(long long b, long long e, long long m){ if (e > 0 && b == 0) return 0; long long ans = 1; b %= m; while (e > 0){ if ((e & 1LL)) ans = (ans * b) % m; e = e >> 1LL; b = (b*b) % m; } return ans; } int main(){ ll H, W, M, a, b, ans=0; cin >> H >> W >> M; for (int m=1; m<=M; m++){ a = (mod_exp(M-m+1, H, modc) + modc - mod_exp(M-m, H, modc)) % modc; b = (mod_exp(M-m+1, W, modc) + modc - mod_exp(M-m, W, modc)) % modc; ans += (a*b) % modc; ans %= modc; } cout << ans << endl; return 0; }