結果

問題 No.2838 Diagonals
ユーザー Carpenters-Cat
提出日時 2024-08-09 22:44:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 3,751 ms
コンパイル使用メモリ 250,260 KB
最終ジャッジ日時 2025-02-23 21:55:41
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 6 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
int main () {
	int H, W;
	cin >> H >> W;
	mint ans = 1;
	char A[555][555];
	for (int i = 0; i <= H; i ++) {
		for (int j = 0; j <= W; j ++) {
			if (min(i, j) == 0) {
				A[i][j] = '.';
			} else {
				cin >> A[i][j];
				if (A[i][j] == '#') {
					ans *= 2;
					if (A[i][j - 1] == '.' || A[i - 1][j] == '.') {
						ans *= 2;
					}
				}
			}
		}
	}
	cout << ans.val() << endl;
}
0