QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#47336#4669. Genetic Modificationsaurelion_solWA 3ms3764kbC++14661b2022-09-08 09:33:342022-09-08 09:33:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-08 09:33:35]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3764kb
  • [2022-09-08 09:33:34]
  • 提交

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