QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#47336 | #4669. Genetic Modifications | aurelion_sol | WA | 3ms | 3764kb | C++14 | 661b | 2022-09-08 09:33:34 | 2022-09-08 09:33:35 |
Judging History
answer
#include<bits/stdc++.h>
#define rp(i,a,b) for(int i=a,_=b;i<=_;++i)
#define pr(i,a,b) for(int i=a,_=b;i>=_;--i)
const int N=1e5+10;
int n,m,m2,mnl[N],p[N];
char s[N],t[N];
inline bool ok(int l,int r){return l>=mnl[r];}
void print(int o){
puts(o?"Yes":"No");
if(o)rp(i,1,m)printf("%d%c",p[i]," \n"[i==m]);
exit(0);
}
int main(){
scanf("%s%s",s+1,t+1);
n=strlen(s+1),m=strlen(t+1);
rp(i,1,n)mnl[i]=s[i]==s[i-1]?mnl[i-1]:i;
rp(i,1,n)if(s[i]==t[p[0]+1])p[++m2]=i,++p[0];
if(m2<m)print(0);
p[m+1]=n+1;
pr(i,m,0){
if(ok(p[i]+1,p[i+1]-1))print(1);
if(!i)print(0);
p[i]=mnl[p[i+1]-1];
if(s[p[i]]!=t[i])--p[i];
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
input:
BBAAABBAAABAAA BAAB
output:
Yes 2 5 8 11
result:
ok good solution
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3764kb
input:
ABABABABAB ABAB
output:
No
result:
wrong output format Unexpected end of file - int32 expected