結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー yakkiyakki
提出日時 2021-05-28 21:21:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,286 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 118,240 KB
実行使用メモリ 817,536 KB
最終ジャッジ日時 2024-04-24 23:36:33
合計ジャッジ時間 3,115 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 MLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0)

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
//using mint = modint998244353;

int dh[] = {-1,0,1,0};
int dw[] = {0,1,0,-1};

ll dp[1000001][100];
ll sum[1000001][101];

int main(){
    int n,k,l; cin >> n >> k >> l;
    dp[0][0] = 1;
    repr(i,1,101) sum[0][i] = 1;
    rep(i,k)rep(j,n){
        dp[i+1][j] += (sum[i][j]-sum[i][max(0,j-l)]+MOD)%MOD;
        dp[i+1][j] %= MOD;
        if(j-l < 0){
            dp[i+1][j] += (sum[i][n]-sum[i][n-l+j]+MOD)%MOD;
            dp[i+1][j] %= MOD;
        }
        sum[i+1][j+1] = (sum[i+1][j]+dp[i+1][j])%MOD ;
    }
    rep(i,n){
        cout << dp[k][i] << endl;
    }
}


0