結果

問題 No.695 square1001 and Permutation 4
ユーザー nikutto_nikutto_
提出日時 2018-06-09 19:48:11
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 553 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 155,148 KB
実行使用メモリ 410,484 KB
最終ジャッジ日時 2023-09-30 01:36:32
合計ジャッジ時間 40,379 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 347 ms
5,712 KB
testcase_02 AC 502 ms
4,376 KB
testcase_03 AC 501 ms
4,376 KB
testcase_04 AC 1,686 ms
4,376 KB
testcase_05 MLE -
testcase_06 AC 3,267 ms
4,380 KB
testcase_07 AC 3,378 ms
4,376 KB
testcase_08 MLE -
testcase_09 MLE -
testcase_10 AC 671 ms
4,380 KB
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 6,857 ms
47,028 KB
権限があれば一括ダウンロードができます

ソースコード

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];
    unordered_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