結果

問題 No.1419 Power Moves
ユーザー kotatsugamekotatsugame
提出日時 2021-03-11 01:59:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 65,904 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 19:18:15
合計ジャッジ時間 5,264 ms
ジャッジサーバーID
(参考情報)
judge1 / 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 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 94 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 15 ms
5,376 KB
testcase_12 AC 99 ms
5,376 KB
testcase_13 AC 93 ms
5,376 KB
testcase_14 AC 117 ms
5,376 KB
testcase_15 AC 117 ms
5,376 KB
testcase_16 AC 122 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 119 ms
5,376 KB
testcase_21 AC 117 ms
5,376 KB
testcase_22 AC 118 ms
5,376 KB
testcase_23 AC 117 ms
5,376 KB
testcase_24 AC 119 ms
5,376 KB
testcase_25 AC 120 ms
5,376 KB
testcase_26 AC 130 ms
5,376 KB
testcase_27 AC 120 ms
5,376 KB
testcase_28 AC 129 ms
5,376 KB
testcase_29 AC 128 ms
5,376 KB
testcase_30 AC 117 ms
5,376 KB
testcase_31 AC 125 ms
5,376 KB
testcase_32 AC 132 ms
5,376 KB
testcase_33 AC 124 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#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;
		}
	}
}
0