結果

問題 No.1694 ZerOne
ユーザー kotatsugamekotatsugame
提出日時 2021-10-01 21:42:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 70,992 KB
実行使用メモリ 54,896 KB
最終ジャッジ日時 2023-09-26 16:48:13
合計ジャッジ時間 2,281 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,660 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
7,856 KB
testcase_03 AC 18 ms
47,088 KB
testcase_04 AC 4 ms
11,824 KB
testcase_05 AC 8 ms
28,408 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 8 ms
24,264 KB
testcase_08 AC 10 ms
30,512 KB
testcase_09 AC 16 ms
47,124 KB
testcase_10 AC 7 ms
24,096 KB
testcase_11 AC 2 ms
5,488 KB
testcase_12 AC 3 ms
7,596 KB
testcase_13 AC 12 ms
34,744 KB
testcase_14 AC 16 ms
47,088 KB
testcase_15 AC 9 ms
30,508 KB
testcase_16 AC 8 ms
26,344 KB
testcase_17 AC 4 ms
13,832 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 12 ms
52,564 KB
testcase_21 AC 26 ms
54,896 KB
testcase_22 AC 12 ms
52,628 KB
testcase_23 AC 26 ms
54,844 KB
testcase_24 AC 19 ms
53,716 KB
testcase_25 AC 19 ms
53,888 KB
testcase_26 AC 12 ms
52,612 KB
testcase_27 AC 25 ms
53,692 KB
testcase_28 AC 14 ms
43,004 KB
testcase_29 AC 15 ms
44,976 KB
testcase_30 AC 16 ms
47,044 KB
testcase_31 AC 18 ms
53,264 KB
testcase_32 AC 19 ms
51,300 KB
testcase_33 AC 19 ms
53,476 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
string S;
vector<int>ids;
const int off=30*30;
long dp[61][61][off*2+1];
main()
{
	cin>>S;
	for(int i=0;i<S.size();i++)if(S[i]=='1')ids.push_back(i);
	dp[0][0][off]=1;
	for(int i=0;i<S.size();i++)for(int j=0;j<=ids.size();j++)
	{
		for(int k=0;k<=off*2;k++)
		{
			dp[i+1][j][k]+=dp[i][j][k];
			if(j<ids.size())
			{
				int nk=k+i-ids[j];
				if(nk>=0&&nk<=off*2)dp[i+1][j+1][nk]+=dp[i][j][k];
			}
		}
	}
	cout<<dp[S.size()][ids.size()][off]<<endl;
}
0