結果

問題 No.1419 Power Moves
ユーザー chocoruskchocorusk
提出日時 2021-03-05 21:53:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 1,625 bytes
コンパイル時間 3,752 ms
コンパイル使用メモリ 186,408 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 09:20:59
合計ジャッジ時間 7,750 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 105 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 18 ms
5,376 KB
testcase_12 AC 111 ms
5,376 KB
testcase_13 AC 101 ms
5,376 KB
testcase_14 AC 133 ms
5,376 KB
testcase_15 AC 133 ms
5,376 KB
testcase_16 AC 129 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 132 ms
5,376 KB
testcase_21 AC 132 ms
5,376 KB
testcase_22 AC 134 ms
5,376 KB
testcase_23 AC 135 ms
5,376 KB
testcase_24 AC 133 ms
5,376 KB
testcase_25 AC 134 ms
5,376 KB
testcase_26 AC 131 ms
5,376 KB
testcase_27 AC 136 ms
5,376 KB
testcase_28 AC 133 ms
5,376 KB
testcase_29 AC 130 ms
5,376 KB
testcase_30 AC 130 ms
5,376 KB
testcase_31 AC 134 ms
5,376 KB
testcase_32 AC 133 ms
5,376 KB
testcase_33 AC 134 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using lll=__int128_t;
ll powmod(ll a, ll k, ll MOD){
    lll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return (ll)ans;
}
using mint=modint1000000007;
int n;
int k;
int main()
{
    cin>>n>>k;
    const ll MOD=1e9+7;
    mint ans1[100010];
    if(n%2==0){
        int r=powmod(2, k-1, n/2);
        for(int i=0; i<r; i++) ans1[2*i+1]+=1;
        mint x=(mint(2).pow(k-1)-r)/mint(n/2);
        for(int i=1; i<n; i+=2){
            ans1[i]+=x;
        }
    }else{
        int r=powmod(2, k-1, n);
        for(int i=0; i<r; i++) ans1[(2*i+1)%n]+=1;
        mint x=(mint(2).pow(k-1)-r)/mint(n);
        for(int i=0; i<n; i++){
            ans1[i]+=x;
        }
    }
    mint ans[100010];
    for(int i=0; i<n; i++){
        ans[i]+=ans1[i];
        ans[(n-i)%n]+=ans1[i];
    }
    mint y=mint(2).pow(k).inv();
    for(int i=0; i<n; i++){
        ans[i]*=y;
        cout<<ans[i].val()<<endl;
    }
    return 0;
}
0