QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#766021 | #9489. 0100 Insertion | zero-range | WA | 27ms | 58388kb | C++23 | 516b | 2024-11-20 15:57:36 | 2024-11-20 15:57:36 |
Judging History
answer
#include<stdio.h>
#define M 505
int f[505][125][255],n;
char s[M];
constexpr int mod=998244353;
int main(){
scanf("%d%s",&n,s);
f[0][0][0]=1;
for(int i=0;i<n;++i) if(s[i]!='1'){
for(int j=0;j<=n/4;++j) for(int k=0;k<=n/2;++k) if(f[i][j][k]){
if(k) (f[i+1][j][k-1]+=f[i][j][k])%=mod;
else (f[i+1][j+1][k]+=f[i][j][k])%=mod;
if(i+1<n&&s[i+1]!='0'){
if(k==1&&j) (f[i+2][j-1][k+1]+=f[i][j][k])%=mod;
else (f[i+2][j][k+2]+=f[i][j][k])%=mod;
}
}
}
printf("%d",f[n][0][0]);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1636kb
input:
8 0??0?100
output:
2
result:
ok "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 1668kb
input:
4 ?10?
output:
1
result:
ok "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 1760kb
input:
28 ???????????0???0??????1???0?
output:
2023
result:
ok "2023"
Test #4:
score: 0
Accepted
time: 0ms
memory: 1492kb
input:
4 ????
output:
1
result:
ok "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
8 11111111
output:
0
result:
ok "0"
Test #6:
score: -100
Wrong Answer
time: 27ms
memory: 58388kb
input:
500 ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
391856657
result:
wrong answer 1st words differ - expected: '870731023', found: '391856657'