QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#143426#6698. Flipping Gameqzez#AC ✓47ms3900kbC++141.1kb2023-08-21 11:23:182023-08-21 11:23:21

Judging History

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

  • [2023-08-21 11:23:21]
  • 评测
  • 测评结果:AC
  • 用时:47ms
  • 内存:3900kb
  • [2023-08-21 11:23:18]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=100+5,M=N*4+5,K=31650,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(time(0));
int n,k,m;char s[N],t[N];
ll C[N][N],f[N],g[N];
void Solve(){
	int i,j;
	scanf("%d%d%d",&n,&k,&m);
	scanf("%s",s+1);
	scanf("%s",t+1);
	for(i=0;i<=n;i++) for(C[i][0]=j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	int Ct=0;
	for(i=1;i<=n;i++) Ct+=(s[i]!=t[i]);
	Me(f,0);f[Ct]=1;
	while(k--){
		Mc(g,f);Me(f,0);
		for(i=0;i<=n;i++){
			for(j=0;j<=min(i,m);j++) f[i-j+m-j]=(f[i-j+m-j]+g[i]*C[i][j]%mod*C[n-i][m-j])%mod;
		}
	}
	printf("%lld\n",f[0]);
}
int main(){
	int t;scanf("%d",&t);while(t--) Solve();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3736kb

input:

3
3 2 1
001
100
3 1 2
001
100
3 3 2
001
100

output:

2
1
7

result:

ok 3 number(s): "2 1 7"

Test #2:

score: 0
Accepted
time: 47ms
memory: 3900kb

input:

1000
8 50 2
11111001
01100001
13 4 5
0010011001101
0000001010010
15 58 12
011111110110100
011010000101000
15 30 2
000101100111101
100010100110000
16 99 15
0111011010111101
1000100101011100
7 73 1
0010010
1010111
1 45 1
1
1
15 64 4
111000001000100
111000110011011
13 16 6
0000001101000
0101001010111
5...

output:

0
0
0
0
0
565123576
0
671397628
866048220
0
0
0
934159397
0
0
0
657964873
0
0
0
297620792
518284447
16636231
1
294524820
259008109
0
0
0
0
0
0
990349196
899244686
0
0
497963164
0
49814547
0
0
0
0
0
529815127
411739397
562040211
0
0
0
0
0
0
0
531433326
0
77531359
703399699
0
0
0
1
0
896329183
0
0
0
0...

result:

ok 1000 numbers