結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー hir355hir355
提出日時 2021-05-28 21:51:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,984 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 202,860 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 00:01:21
合計ジャッジ時間 4,159 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
constexpr long long INF_LL = 2000000000000000000LL;
constexpr int INF = 2000000000;
constexpr long long MOD = 1000000007;
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
// typedef float double;
// typedef priority_queue prique;
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
//typedef vector<vi> matrix;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll b, ll m) {
    if(b == 0)
        return 1;
    ll t = modpow(a, b / 2, m);
    if(b & 1) {
        return (t * t % m) * a % m;
    } else {
        return t * t % m;
    }
}

struct edge {
    int to;
    ll cost;
    edge(int t, ll c) { to = t, cost = c; }
};

typedef vector<vector<edge>> graph;

using mint = modint1000000007;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n, k, l;
    cin >> n >> k >> l;
    vector<vector<mint>> mat(n, vector<mint>(n, 0)), res(n, vector<mint>(n, 0));
    rep(i, n) {
        REP(j, i + 1, l + i + 1){
            mat[i][j % n] += 1;
        }
        res[i][i] = 1;
    }
    while(k > 0){
        if(k & 1){
            vector<vector<mint>> tmp(n, vector<mint>(n, 0));
            rep(i, n) rep(j, n) rep(p, n) tmp[i][j] += res[i][p] * mat[p][j];
            tmp.swap(res);
        }
        vector<vector<mint>> tmp(n, vector<mint>(n, 0));
        rep(i, n) rep(j, n) rep(p, n) tmp[i][j] += mat[i][p] * mat[p][j];
        tmp.swap(mat);
        k >>= 1;
    }
    rep(i, n){
        cout << res[i][0].val() << endl;
    }
}
0