結果

問題 No.1327 グラフの数え上げ
ユーザー 👑 NachiaNachia
提出日時 2020-12-27 20:14:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 680 bytes
コンパイル時間 2,547 ms
コンパイル使用メモリ 197,704 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-25 00:24:53
合計ジャッジ時間 6,168 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 121 ms
4,380 KB
testcase_02 AC 133 ms
4,380 KB
testcase_03 AC 133 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 51 ms
4,380 KB
testcase_10 AC 150 ms
4,376 KB
testcase_11 AC 133 ms
4,380 KB
testcase_12 AC 134 ms
4,384 KB
testcase_13 AC 133 ms
4,376 KB
testcase_14 AC 134 ms
4,376 KB
testcase_15 AC 134 ms
4,380 KB
testcase_16 AC 134 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

const ULL M=1000000007,D=1<<25,
T[] = {
	1,361946029,117175975,532814826,
	638916270,709912685,565479858,534784668,
	864357307,580002085,988122582,626052914,
	711403642,930569788,928062158,782871805,
	373979365,75908005,861919911,973727253,
	963971145,892153437,976333508,204474745,
	183143523,224645330,885152995,514060757,
	894672548,683957845
};

int main(){
	ULL x=0;
	ULL ans=0;
	char c; while(c=getchar(),'0'<=c&&c<='9'&&x<1<<30) x=x*10+c-'0';
	x=min(x-1,M);
	ans=T[x/D];
	rep(i,x%D) ans=M-ans*(x-i)%M;
	cout<<ans%M<<endl;
	return 0;
}
0