結果
問題 | No.1419 Power Moves |
ユーザー |
|
提出日時 | 2021-03-11 01:59:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 119 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 66,340 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-12 16:51:51 |
合計ジャッジ時間 | 4,813 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; const long mod=1e9+7; long mp(long a,long b,long m){return b?mp(a*a%m,b/2,m)*(b%2?a:1)%m:1;} int N,K; main() { cin>>N>>K; int nr=(mp(2,K,2*N)+2*N-1)%(2*N); long all=(mp(2,K,mod)+mod-nr-1)*mp(2*N,mod-2,mod)%mod; long inv=mp(mp(2,K,mod),mod-2,mod); for(int i=0;i<N;i++) { if(N%2==1) { long ans=all*2; if(nr>=(i%2==0?N+i:i))ans++; if(2*N-nr<=(i%2==0?N+i:i))ans++; cout<<ans*inv%mod<<endl; } else if(i%2==0)cout<<0<<endl; else { long ans=all*4; if(nr>=i)ans++; if(nr>=N+i)ans++; if(2*N-nr<=i)ans++; if(2*N-nr<=N+i)ans++; cout<<ans*inv%mod<<endl; } } }