結果

問題 No.1419 Power Moves
ユーザー 沙耶花
提出日時 2021-03-05 22:45:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 725 bytes
コンパイル時間 4,182 ms
コンパイル使用メモリ 252,148 KB
最終ジャッジ日時 2025-01-19 11:40:16
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001


int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<mint> cnt(N,0);
	int t = pow_mod(2,K,N);
	rep(i,t)cnt[i]++;
	{
		mint x = mint(2).pow(K);
		x -= t;
		x /= N;
		rep(i,N){
			cnt[i]+=x;
			cnt[i] /= mint(2).pow(K);
		}
	}
	
	{
		vector<mint> ncnt(N,0);
		rep(i,N){
			ncnt[(i*2)%N] += cnt[i];
		}
		swap(cnt,ncnt);
	}
	
	long long cur = (pow_mod(2,K,N)-1);
	cur %= N;
	if(cur<0)cur += N;
	vector<mint> ans(N);
	rep(i,N){
		ans[i] = cnt[(cur+i)%N];
	}
	rep(i,N){
		cout<<ans[i].val()<<endl;
	}
	
	
    return 0;
}
0