結果

問題 No.695 square1001 and Permutation 4
ユーザー cielciel
提出日時 2018-06-10 20:22:31
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 413 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 83,520 KB
実行使用メモリ 159,008 KB
最終ジャッジ日時 2023-09-30 01:35:24
合計ジャッジ時間 4,760 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 18 ms
10,532 KB
testcase_02 AC 39 ms
41,576 KB
testcase_03 AC 27 ms
41,576 KB
testcase_04 AC 84 ms
41,576 KB
testcase_05 AC 129 ms
41,476 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 AC 60 ms
18,284 KB
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

long long solve(int n,long long M,const vector<int> &x){
	vector<long long> v(n);v[0]=1;
	for(int i=1;i<n;i++)for(auto &e:x){
		if(e<=i)v[i]=(v[i]+v[i-e])%M;
	}
	return v[n-1];
}

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]);
	printf("%lld\n",solve(n,100000000000000007LL,x));
}
0