結果
| 問題 | No.695 square1001 and Permutation 4 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-13 16:26:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 512 bytes |
| コンパイル時間 | 405 ms |
| コンパイル使用メモリ | 54,320 KB |
| 実行使用メモリ | 81,024 KB |
| 最終ジャッジ日時 | 2024-07-22 20:04:18 |
| 合計ジャッジ時間 | 7,777 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 MLE * 3 |
ソースコード
#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]);
}