結果

問題 No.695 square1001 and Permutation 4
ユーザー nikutto_nikutto_
提出日時 2018-06-09 19:47:15
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 543 bytes
コンパイル時間 2,287 ms
コンパイル使用メモリ 154,408 KB
実行使用メモリ 113,532 KB
最終ジャッジ日時 2023-09-30 01:34:27
合計ジャッジ時間 13,915 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 1,436 ms
7,108 KB
testcase_02 AC 256 ms
4,376 KB
testcase_03 AC 298 ms
4,376 KB
testcase_04 AC 803 ms
4,380 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

using ll=long long;
const ll MOD=100000000000000007;


int main(){
    int n,m;
    cin>>n>>m;
    vector<int> x(m);
    for(int i=0;i<m;i++) cin>>x[i];
    map<int,ll> dp;
    dp[0]=1;
    for(int i=0;i<n-1;i++){
        for(int j=0;j<m;j++){
            if(i+x[j]<n){
                dp[i+x[j]]+=dp[i];
                if(dp[i+x[j]]>=MOD){
                    dp[i+x[j]]-=MOD;
                }
            }
        }
        dp.erase(dp.find(i));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}
0