結果

問題 No.695 square1001 and Permutation 4
ユーザー cielciel
提出日時 2020-11-13 16:26:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 512 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 53,504 KB
実行使用メモリ 80,668 KB
最終ジャッジ日時 2023-09-30 02:09:18
合計ジャッジ時間 8,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 56 ms
6,556 KB
testcase_02 AC 130 ms
22,068 KB
testcase_03 AC 65 ms
22,024 KB
testcase_04 AC 309 ms
22,168 KB
testcase_05 AC 513 ms
22,136 KB
testcase_06 AC 1,191 ms
41,452 KB
testcase_07 AC 556 ms
41,452 KB
testcase_08 AC 362 ms
41,448 KB
testcase_09 AC 843 ms
41,484 KB
testcase_10 AC 240 ms
10,292 KB
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	vector<int>x(m);
	for(int i=0;i<m;i++)scanf("%d",&x[i]);
	vector<int>bag(n);
	vector<int>Ma={168647939,592951213};
	vector<int>R;
	for(auto &M: Ma){
		bag[0]=1;
		for(int i=1;i<n;i++)bag[i]=0;
		for(int i=1;i<n;i++){
			for(auto &e: x)if(e<=i)bag[i]=(bag[i]+bag[i-e])%M;
		}
		R.push_back(bag[n-1]);
	}
	long long Rm=(R[1]-R[0]+Ma[1])*442445312LL%Ma[1];
	printf("%lld\n",Rm*Ma[0]+R[0]);
}
0