結果

問題 No.1631 Sorting Integers (Multiple of K) Easy
ユーザー kotatsugamekotatsugame
提出日時 2021-07-30 20:51:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 485 ms / 3,000 ms
コード長 411 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 68,284 KB
実行使用メモリ 131,220 KB
最終ジャッジ日時 2023-10-14 03:07:34
合計ジャッジ時間 7,059 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 4 ms
6,676 KB
testcase_04 AC 2 ms
4,352 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 2 ms
4,352 KB
testcase_09 AC 3 ms
4,356 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 332 ms
131,032 KB
testcase_15 AC 485 ms
130,864 KB
testcase_16 AC 483 ms
131,220 KB
testcase_17 AC 484 ms
130,984 KB
testcase_18 AC 482 ms
131,044 KB
testcase_19 AC 481 ms
130,940 KB
testcase_20 AC 103 ms
124,152 KB
testcase_21 AC 126 ms
131,004 KB
testcase_22 AC 160 ms
129,044 KB
testcase_23 AC 272 ms
130,160 KB
testcase_24 AC 210 ms
129,844 KB
testcase_25 AC 193 ms
130,336 KB
testcase_26 AC 31 ms
97,864 KB
testcase_27 AC 362 ms
131,168 KB
testcase_28 AC 194 ms
117,660 KB
testcase_29 AC 176 ms
117,744 KB
testcase_30 AC 250 ms
127,808 KB
testcase_31 AC 357 ms
131,076 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int N,K;
int c[14];
long dp[1<<14][1000];
main()
{
	cin>>N>>K;
	int sz=0;
	long v=1;
	for(int i=1;i<=9;i++)
	{
		int C;cin>>C;
		for(;C;v*=C--)c[sz++]=i;
	}
	dp[0][0]=1;
	for(int i=0;i<1<<N;i++)for(int j=0;j<K;j++)if(dp[i][j])
	{
		for(int k=0;k<N;k++)if(!(i>>k&1))
		{
			dp[i|1<<k][(j*10+c[k])%K]+=dp[i][j];
		}
	}
	cout<<dp[(1<<N)-1][0]/v<<endl;
}
0