QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#832485 | #8701. Border | DerrickLo | 0 | 0ms | 3552kb | C++14 | 839b | 2024-12-25 21:57:56 | 2024-12-25 21:58:02 |
answer
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
int n,f[2][183][797][2],ans,t=510;
string s;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>s,s=" "+s;
for(int i=1;i<n+1-i;i++)swap(s[i],s[n+1-i]);
f[0][0][t][0]=1;
for(int i=1;i<=n;i++){
int now=(i&1);
for(int j=0;j<=i/3+1;j++)for(int k=t-i;k<=t+j;k++)f[now][j][k][0]=f[now][j][k][1]=0;
if(s[i]!='0'){
for(int j=0;j<=(i-1)/3+1;j++)for(int k=t-(i-1);k<=t+j;k++)if(k+3-t<=j+1)f[now][max(j,k+3-t)][k+3][1]=(f[now][max(j,k+3-t)][k+3][1]+f[now^1][j][k][0])%mod;
}
if(s[i]!='1'){
for(int j=0;j<=(i-1)/3+1;j++)for(int k=t-(i-1);k<=t+j;k++)f[now][j][k-1][0]=(f[now][j][k-1][0]+(f[now^1][j][k][1]+f[now^1][j][k][0])%mod)%mod;
}
}
for(int i=0;i<=n/3+1;i++)ans=(ans+f[n&1][i][t][0])%mod;
cout<<ans;
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3552kb
input:
cbaababaabacbaababaabacbaabacbaababaabacbaaba dabbababbabaabbafabbgbaabfebaabzababbayaabcac
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%