QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#245946 | #4666. Delete And Win | Eznibuil | WA | 0ms | 3192kb | C++14 | 573b | 2023-11-10 14:44:58 | 2023-11-10 14:44:59 |
Judging History
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'