QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#245946#4666. Delete And WinEznibuilWA 0ms3192kbC++14573b2023-11-10 14:44:582023-11-10 14:44:59

Judging History

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

  • [2023-11-10 14:44:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3192kb
  • [2023-11-10 14:44:58]
  • 提交

answer

#include<stdio.h>
char s[100001],t[100001],mt[17][100001];
int solve(int x,int y)
{
	if(!s[x])
		return 114514;
	int z=y;
	while(s[x]<t[z])
		z++;
	if(t[z]<s[x])
		return z-y;
	int ans=solve(x+1,z+1)+z-y;
	for(int i=16;~i;i--)
		if(z+(1<<i)<=100001&&mt[i][z]>=s[x])
			z+=1<<i;
	return ans<z-y?ans:z-y;
}
int main()
{
	scanf("%s%s",s,t);
	for(int i=0;i<100001;i++)
		mt[0][i]=t[i];
	for(int i=0;i<16;i++)
		for(int j=0;j<=100001-(1<<i+1);j++)
			mt[i+1][j]=mt[i][j]<mt[i][j+(1<<i)]?mt[i][j]:mt[i][j+(1<<i)];
	printf("%d",solve(0,0));
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3192kb

input:

pqsrpspqz
pqrpqz

output:

0

result:

wrong answer 1st numbers differ - expected: '2', found: '0'