QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#207878#5749. Directed Vertex Cactixia_mcRE 2ms9404kbC++14497b2023-10-08 21:56:312023-10-08 21:56:31

Judging History

你现在查看的是最新测评结果

  • [2023-10-08 21:56:31]
  • 评测
  • 测评结果:RE
  • 用时:2ms
  • 内存:9404kb
  • [2023-10-08 21:56:31]
  • 提交

answer

#include<stdio.h>

#define int long long 

const int N=1e6,mod=1e9+9;
int ksm(int x,int y){
	int s=1;
	while(y){
		if(y&1) (s*=x)%=mod;
		(x*=x%mod)%=mod;y>>=1;
	}
	return s;
}
int fact[N];
int inv(int x){return ksm(x,mod-2);}
void init(){fact[0]=1;for(int i=1;i<=N;i++) fact[i]=fact[i-1]*i;}
int C(int n,int m){return fact[n]*inv(fact[n-m])%mod*(inv(fact[m]))%mod;}
int n,m;
signed main(){
	init();scanf("%lld%lld",&n,&m);
	printf("%lld\n",fact[n]*C(C(n,2),m));
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 9404kb

input:

3 1

output:

18

result:

ok 1 number(s): "18"

Test #2:

score: 0
Accepted
time: 2ms
memory: 9344kb

input:

4 4

output:

360

result:

ok 1 number(s): "360"

Test #3:

score: -100
Runtime Error

input:

39847 348708

output:


result: