QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#245901 | #4669. Genetic Modifications | Selnev | WA | 0ms | 8000kb | C++14 | 1.9kb | 2023-11-10 14:33:07 | 2023-11-10 14:33:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
bitset<50005>bsa[50005],cura,bs1a,bs2a;
bitset<100005>bsb[50005],curb,bs1b,bs2b;
char s[100005],t[100005];bool ck[100005];
int lst[2],n,m;
const int T=50000;
vector<int>out;
int main(){
scanf("%s",s+1);scanf("%s",t+1);
n=strlen(s+1),m=strlen(t+1);
bs1a.reset(),bs2a.reset(),bsa[0].reset();
bs1b.reset(),bs2b.reset(),bsb[0].reset();
for(int i=1;i<=min(m,T);i++)if(t[i]=='0')bs2a[i]=1;else bs1a[i]=1;
for(int i=1;i<=m;i++)if(t[i]=='0')bs2b[i]=1;else bs1b[i]=1;
bsa[0][0]=1;
int lls=-1;
for(int i=1;i<=n;i++){
int p=lst[(s[i-1]-'0')^1];
if(p!=lls){
if(p<=50000&&i>50001){
cura.reset();
curb.reset();
for(int j=p;j<i;j++){
if(j<=T)cura|=bsa[j];
else{
if(j==T)for(int l=0;l<=T;l++)curb[l]=cura[l];
curb|=bsb[j-T];
}
}
}
if(i<=50001){
cura.reset();
for(int j=p;j<i;j++)cura|=bsa[j];
}
if(p>50000){
curb.reset();
for(int j=p;j<i;j++)curb|=bsb[j-T];
}
lls=p;
}
if(i<=T){
if(s[i]=='0')bsa[i]=bs2a;
else bsa[i]=bs1a;
bsa[i]&=(cura<<1);
lst[s[i]-'0']=i;
cura|=bsa[i];
}
else{
if(i==T+1)for(int j=0;j<=T;j++)curb[j]=cura[j];
if(s[i]=='0')bsb[i-T]=bs2b;
else bsb[i-T]=bs1b;
bsb[i-T]&=(curb<<1);
lst[s[i]-'0']=i;
curb|=bsb[i-T];
}
}
ck[n]=1;
for(int i=n-1;i;i--){
if(s[i+1]==s[n])ck[i]=1;
else break;
}
int pos=-1;
for(int i=1;i<=50000;i++){
if(m<=T&&bsa[i][m]&&ck[i])pos=i;
}
for(int i=1;i<=50000;i++){
if(bsb[i][m]&&ck[i+T])pos=i+T;
}
if(pos==-1){
puts("NO");
return 0;
}
puts("YES");
out.push_back(pos);
for(int i=m-1;i;i--){
pos--;
while(pos){
if(pos<=T&&bsa[pos][i])break;
if(pos>T&&bsb[pos-T][i])break;
pos--;
}
out.push_back(pos);
}
reverse(out.begin(),out.end());
for(auto to:out)printf("%d ",to);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 8000kb
input:
BBAAABBAAABAAA BAAB
output:
YES 11 12 13 14
result:
wrong answer wrong solution [1]