結果

問題 No.695 square1001 and Permutation 4
ユーザー nikutto_nikutto_
提出日時 2018-06-09 19:44:58
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 515 bytes
コンパイル時間 3,414 ms
コンパイル使用メモリ 146,304 KB
実行使用メモリ 159,360 KB
最終ジャッジ日時 2023-09-30 01:34:13
合計ジャッジ時間 4,683 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 13 ms
10,648 KB
testcase_02 AC 27 ms
42,252 KB
testcase_03 AC 25 ms
42,192 KB
testcase_04 AC 54 ms
42,192 KB
testcase_05 AC 51 ms
42,100 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 AC 23 ms
18,676 KB
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
権限があれば一括ダウンロードができます

ソースコード

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];
    vector<ll> dp(n);
    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;
                }
            }
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}
0