結果

問題 No.1710 Minimum OR is X
ユーザー kotatsugamekotatsugame
提出日時 2021-10-19 02:51:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 68,900 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 04:16:58
合計ジャッジ時間 2,317 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 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 2 ms
4,348 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 5 ms
4,348 KB
testcase_11 AC 4 ms
4,348 KB
testcase_12 AC 4 ms
4,348 KB
testcase_13 AC 5 ms
4,348 KB
testcase_14 AC 4 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 4 ms
4,348 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 7 ms
4,348 KB
testcase_19 AC 6 ms
4,348 KB
testcase_20 AC 4 ms
4,348 KB
testcase_21 AC 8 ms
4,348 KB
testcase_22 AC 9 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 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
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N,M,K;
string X;
mint comb[201][201];
mint dp[201][201];
mint p2[201];
main()
{
	cin>>N>>M>>K>>X;
	for(int i=0;i<=200;i++)
	{
		comb[i][0]=comb[i][i]=1;
		for(int j=1;j<i;j++)comb[i][j]=comb[i-1][j-1]+comb[i-1][j];
		p2[i]=mint(2).pow(i);
	}
	dp[0][N]=1;
	for(int i=0;i<M;i++)
	{
		for(int j=K;j<=N;j++)
		{
			if(X[i]=='0')
			{
				for(int l=0;j-l>=K;l++)
				{
					dp[i+1][j-l]+=dp[i][j]*comb[j][l]*p2[N-j];
				}
			}
			else
			{
				for(int l=K-1;l>=0;l--)
				{
					dp[i+1][j]+=dp[i][j]*comb[j][l]*p2[N-j];
				}
			}
		}
	}
	mint ans=0;
	for(int j=K;j<=N;j++)ans+=dp[M][j];
	cout<<ans.val()<<endl;
}
0