結果
| 問題 |
No.1521 Playing Musical Chairs Alone
|
| コンテスト | |
| ユーザー |
hir355
|
| 提出日時 | 2021-05-28 21:51:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,984 bytes |
| コンパイル時間 | 2,242 ms |
| コンパイル使用メモリ | 201,744 KB |
| 最終ジャッジ日時 | 2025-01-21 19:59:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 15 |
ソースコード
#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;
}
}
hir355