結果

問題 No.1710 Minimum OR is X
ユーザー rtyurtyu
提出日時 2021-10-18 10:19:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 1,057 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 68,472 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 07:31:52
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 4 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 6 ms
4,348 KB
testcase_10 AC 9 ms
4,348 KB
testcase_11 AC 8 ms
4,348 KB
testcase_12 AC 6 ms
4,348 KB
testcase_13 AC 6 ms
4,348 KB
testcase_14 AC 6 ms
4,348 KB
testcase_15 AC 4 ms
4,348 KB
testcase_16 AC 5 ms
4,348 KB
testcase_17 AC 6 ms
4,348 KB
testcase_18 AC 11 ms
4,348 KB
testcase_19 AC 11 ms
4,348 KB
testcase_20 AC 11 ms
4,348 KB
testcase_21 AC 11 ms
4,348 KB
testcase_22 AC 11 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 5 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 3 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

const long long md = 998244353;
long long cb[209][209], d[209][209], r2[209];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, k; cin >> n >> m >> k;
	string x; cin >> x;
	cb[0][0] = r2[0] = 1;
	for (int i = 1; i <= n; i++) {
		r2[i] = (r2[i - 1] * 2) % md;
		for (int j = 0; j <= n; j++) {
			cb[i][j] = cb[i - 1][j];
			if (j) cb[i][j] = (cb[i][j] + cb[i - 1][j - 1]) % md;
		}
	}
	d[0][n] = 1;
	for (int i = 1; i <= m; i++) {
		if (x[i - 1] == '0') {
			for (int j = k; j <= n; j++) {
				for (int pi = j; pi <= n; pi++)
					d[i][j] = (d[i][j] + d[i - 1][pi] * ((cb[pi][j] * r2[n - pi]) % md)) % md;
			}
		}
		else {
			for (int j = 0; j <= n; j++) {
				for (int pi = 0; pi < k && pi <= j; pi++)
					d[i][j] = (d[i][j] + cb[j][pi]) % md;
				d[i][j] = (d[i][j] * d[i - 1][j]) % md;
				d[i][j] = (d[i][j] * r2[n - j]) % md;
			}
		}
	}
	long long ans = 0;
	for (int i = 0; i <= n; i++)
		ans = (ans + d[m][i]) % md;
	cout << ans << '\n';
	return 0;
}
0