QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449264#8792. Candieskkkgjyismine4AC ✓1199ms394624kbC++231.4kb2024-06-20 20:51:542024-06-20 20:51:55

Judging History

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

  • [2024-06-20 20:51:55]
  • 评测
  • 测评结果:AC
  • 用时:1199ms
  • 内存:394624kb
  • [2024-06-20 20:51:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
void add(int &x,const int y){x=((x+y>=mod)?(x+y-mod):(x+y));}
void sub(int &x,const int y){x=((x>=y)?(x-y):(x+mod-y));}
int mul(int x,int y){return 1ll*x*y%mod;}
int qpow(int a,int b){
	int c=1;
	while(b){
		if(b&1)c=mul(c,a);
		a=mul(a,a),b>>=1;
	}return c;
}
int a,b,c,fac[30005],ifac[30005],Prod[30005],iProd[30005],inv[30005],pw[30005];
int C(int n,int m){return mul(mul(fac[n],ifac[m]),ifac[n-m]);}
int calc(int n,int k){
	return 1ll*pw[n]*(k+k+1)%mod*inv[n+k+1]%mod*inv[n+n+k+k+1]%mod*C(k+k,k)%mod*C(n+n+n+k+k,n)%mod;
}
int f(int a,int b){a-=b;return calc(b,a);}
int g(int a,int b,int c){return mul(fac[a+b+c],mul(ifac[a],mul(ifac[b],ifac[c])));}
int A[10005][10005];
int main(){
	ifac[0]=fac[0]=Prod[0]=iProd[0]=1,pw[0]=1;
	for(int i=1;i<=30000;++i){
		fac[i]=mul(i,fac[i-1]),ifac[i]=qpow(fac[i],mod-2),inv[i]=qpow(i,mod-2),pw[i]=pw[i-1]*4ll%mod;
		int x=mul(2*i,qpow(2*i+1,mod-2));
		Prod[i]=mul(Prod[i-1],x),iProd[i]=qpow(Prod[i],mod-2);
	}
	cin>>a>>b>>c;
	for(int i=0;i<=max(b-1,c-1);++i)for(int j=0;j<=i;++j)A[i][j]=f(i,j);
	int Ans=g(a,b,c);
	for(int i=0;i<=min(a,b-1);++i)
	  for(int j=0;j<=min(i,c);++j)sub(Ans,mul(A[i][j],g(a-i,b-1-i,c-j)));
	for(int i=0;i<=min(a,c-1);++i)
	  for(int j=0;j<=min(i,b);++j)sub(Ans,mul(A[i][j],g(a-i,b-j,c-1-i)));
	cout<<Ans;
	return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 16ms
memory: 4216kb

input:

4 3 2

output:

368

result:

ok answer is '368'

Test #2:

score: 0
Accepted
time: 1199ms
memory: 394624kb

input:

10000 10000 10000

output:

905642282

result:

ok answer is '905642282'

Test #3:

score: 0
Accepted
time: 13ms
memory: 8384kb

input:

99 99 99

output:

604759627

result:

ok answer is '604759627'

Test #4:

score: 0
Accepted
time: 1010ms
memory: 389600kb

input:

10000 9876 6543

output:

172894229

result:

ok answer is '172894229'

Test #5:

score: 0
Accepted
time: 12ms
memory: 4224kb

input:

7 1 6

output:

5577

result:

ok answer is '5577'

Test #6:

score: 0
Accepted
time: 16ms
memory: 4500kb

input:

28 23 17

output:

816429586

result:

ok answer is '816429586'

Test #7:

score: 0
Accepted
time: 16ms
memory: 6376kb

input:

87 54 22

output:

401507657

result:

ok answer is '401507657'

Test #8:

score: 0
Accepted
time: 17ms
memory: 8168kb

input:

50 40 16

output:

770938562

result:

ok answer is '770938562'

Test #9:

score: 0
Accepted
time: 16ms
memory: 6544kb

input:

72 19 53

output:

607733148

result:

ok answer is '607733148'

Test #10:

score: 0
Accepted
time: 16ms
memory: 4340kb

input:

8 4 4

output:

325590

result:

ok answer is '325590'

Test #11:

score: 0
Accepted
time: 13ms
memory: 4500kb

input:

65 45 14

output:

452076388

result:

ok answer is '452076388'

Test #12:

score: 0
Accepted
time: 13ms
memory: 6532kb

input:

82 8 67

output:

708832480

result:

ok answer is '708832480'

Test #13:

score: 0
Accepted
time: 16ms
memory: 4464kb

input:

65 10 35

output:

769016918

result:

ok answer is '769016918'

Test #14:

score: 0
Accepted
time: 16ms
memory: 4340kb

input:

4 3 4

output:

1408

result:

ok answer is '1408'

Test #15:

score: 0
Accepted
time: 294ms
memory: 255868kb

input:

9139 6356 279

output:

833879698

result:

ok answer is '833879698'

Test #16:

score: 0
Accepted
time: 75ms
memory: 98604kb

input:

3888 2407 1937

output:

380556889

result:

ok answer is '380556889'

Test #17:

score: 0
Accepted
time: 564ms
memory: 313600kb

input:

9161 3171 7913

output:

643956900

result:

ok answer is '643956900'

Test #18:

score: 0
Accepted
time: 32ms
memory: 57744kb

input:

1392 1354 938

output:

491399135

result:

ok answer is '491399135'

Test #19:

score: 0
Accepted
time: 29ms
memory: 59696kb

input:

5930 427 1403

output:

786969030

result:

ok answer is '786969030'

Test #20:

score: 0
Accepted
time: 17ms
memory: 10528kb

input:

507 99 150

output:

960656496

result:

ok answer is '960656496'

Test #21:

score: 0
Accepted
time: 92ms
memory: 110264kb

input:

3119 2372 2681

output:

751161512

result:

ok answer is '751161512'

Test #22:

score: 0
Accepted
time: 168ms
memory: 147804kb

input:

6636 3688 2743

output:

839083240

result:

ok answer is '839083240'

Test #23:

score: 0
Accepted
time: 67ms
memory: 118516kb

input:

4890 475 2865

output:

788640273

result:

ok answer is '788640273'

Test #24:

score: 0
Accepted
time: 293ms
memory: 254216kb

input:

6708 663 6384

output:

426276232

result:

ok answer is '426276232'

Test #25:

score: 0
Accepted
time: 16ms
memory: 4412kb

input:

1 1 1

output:

2

result:

ok answer is '2'

Extra Test:

score: 0
Extra Test Passed