QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#419324#8701. BorderWilliamxzh#0 0ms0kbC++23468b2024-05-23 20:20:212024-05-23 20:20:22

Judging History

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

  • [2024-05-23 20:20:22]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-05-23 20:20:21]
  • 提交

answer

#include <bits/stdc++.h>
#define il inline
using namespace std;
const int N=2e6+5;
int n,nxt[N];char s[N],t[N];
il int calc(){
    for(int i=2,j;i<=n;++i){
        while(j && s[i]!=s[j+1]) j=nxt[j];
        if(s[i]==s[j+1]) ++j;
        nxt[i]=j;
    }return nxt[n];
}
char c;
int main(){
    scanf("%s%s",s+1,t+1);n=strlen(s+1);
    for(int i=1;i<=n;++i){
        c=s[i],s[i]=t[i];printf("%d\n",calc());
        s[i]=c;
    }



    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

cbaababaabacbaababaabacbaabacbaababaabacbaaba
dabbababbabaabbafabbgbaabfebaabzababbayaabcac

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%