結果

問題 No.695 square1001 and Permutation 4
ユーザー ciel
提出日時 2018-06-10 20:22:31
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 413 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 121,088 KB
実行使用メモリ 159,096 KB
最終ジャッジ日時 2024-07-22 19:32:39
合計ジャッジ時間 3,883 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 MLE * 7
権限があれば一括ダウンロードができます

ソースコード

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