結果

問題 No.1766 Tatsujin Remix
ユーザー startcppstartcpp
提出日時 2021-11-26 22:57:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,091 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 66,792 KB
実行使用メモリ 8,476 KB
最終ジャッジ日時 2023-09-12 05:25:00
合計ジャッジ時間 2,227 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 16 ms
6,200 KB
testcase_10 AC 16 ms
6,172 KB
testcase_11 AC 16 ms
6,280 KB
testcase_12 AC 17 ms
6,368 KB
testcase_13 AC 19 ms
6,828 KB
testcase_14 AC 26 ms
8,184 KB
testcase_15 AC 26 ms
8,476 KB
testcase_16 AC 26 ms
8,304 KB
testcase_17 AC 26 ms
8,188 KB
testcase_18 AC 26 ms
8,228 KB
testcase_19 AC 26 ms
8,224 KB
testcase_20 AC 26 ms
8,284 KB
testcase_21 AC 26 ms
8,184 KB
testcase_22 AC 26 ms
8,188 KB
testcase_23 AC 26 ms
8,336 KB
testcase_24 AC 21 ms
8,308 KB
testcase_25 AC 32 ms
8,296 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:34:42: 警告: ‘hoge’ may be used uninitialized [-Wmaybe-uninitialized]
   34 |                                 if (hoge > 0 && k != hoge) continue;
      |                                     ~~~~~^~~
main.cpp:29:29: 備考: ‘hoge’ はここで定義されています
   29 |                         int hoge;
      |                             ^~~~

ソースコード

diff #

//サンプル1はやわらか戦車おに裏
//サンプル2はドンカマ2000おに
//サンプル3と4が分からーん!なんだっけこれ!??
#include <iostream>
#include <string>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
string s;
int dp[200001][3]; //dp[何文字決めたか][0:休符, 1:d, 2:k]
int mod = 998244353;

signed main() {
	int i, j, k;
	
	cin >> n;
	rep(i, n) {
		string tmp;
		cin >> tmp;
		s += tmp;
	}
	n *= 16;
	
	dp[0][0] = 1;
	rep(i, n) {
		rep(j, 3) {
			int hoge;
			if (s[i] == '.') hoge = 0;
			if (s[i] == 'd') hoge = 1;
			if (s[i] == 'k') hoge = 2;
			rep(k, 3) {
				if (hoge > 0 && k != hoge) continue;
				if (i % 2 == 0 && j > 0 && k == 0) continue;
				if (i % 2 == 1 && j == 0 && k > 0) continue;
				if (i > 0 && s[i - 1] == '.' && j == 1 && hoge == 1) continue;
				if (i > 0 && s[i - 1] == '.' && j == 2 && hoge == 2) continue;
				dp[i + 1][k] += dp[i][j];
				dp[i + 1][k] %= mod;
			}
		}
	}
	
	int ans = 0;
	rep(j, 3) ans += dp[n][j];
	ans %= mod;
	
	cout << ans << endl;
	return 0;
}
0