結果
| 問題 |
No.3255 01 Matrix Counting
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 23:02:53 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 791 bytes |
| コンパイル時間 | 2,028 ms |
| コンパイル使用メモリ | 192,824 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-05 23:03:46 |
| 合計ジャッジ時間 | 2,761 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 |
コンパイルメッセージ
main.cpp: In function ‘int32_t main()’:
main.cpp:30:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
30 | freopen(TASKNAME ".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:31:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | freopen(TASKNAME ".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define db double
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b / __gcd(a,b)
#define I first
#define II second
#define pb push_back
#define ii pair<int,int>
const int INF = 2 * 1e9;
const int N = 2e5 + 1;
const int MOD = 998244353;
int pw(int a, int b) {
int res = 1;
while (b) {
if (b & 1) res = (res * a) % MOD;
b /= 2;
a = (a * a) % MOD;
}
return res;
}
int32_t main()
{
#define TASKNAME "test"
ios_base::sync_with_stdio(0);
cin.tie(0);
if (fopen(TASKNAME ".inp","r" ))
{
freopen(TASKNAME ".inp","r",stdin);
freopen(TASKNAME ".out","w",stdout);
}
int h, w;
cin >> h >> w;
cout << pw(2, (h - 1) * (w - 1) + 2);
return 0;
}