QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#208620#5749. Directed Vertex CacticzcWA 0ms3716kbC++14568b2023-10-09 19:26:062023-10-09 19:26:07

Judging History

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

  • [2023-10-09 19:26:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3716kb
  • [2023-10-09 19:26:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
const int mod=1e9+7;
inline int qpow(int a,int b){
	int ret=1;
	for( ; b; b>>=1){
		if(b&1) ret=ret*a%mod;
		a=a*a%mod;
	}
	return ret;
}
inline int C(int x,int y){
	if(x<y) return 0;
	int ret=1ll,inv=1ll;
	for(int i=max(x-y,y)+1;i<=x;i++) ret=ret*i%mod;
	for(int i=1;i<=min(x-y,y);i++) inv=inv*i%mod;
	return ret*qpow(inv,mod-2)%mod;
}
signed main(){
	cin>>n>>m;
	int ans=1;
	for(int i=1;i<=n;i++)  ans=ans*i%mod;
	ans=ans*C(C(n,2),m)%mod;
	cout<<ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 1

output:

18

result:

ok 1 number(s): "18"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

4 4

output:

360

result:

ok 1 number(s): "360"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3716kb

input:

39847 348708

output:

448520477

result:

wrong answer 1st numbers differ - expected: '983575456', found: '448520477'