QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#124241 | #464. 前缀函数 / KMP | Ignotus# | WA | 1ms | 3388kb | C++14 | 354b | 2023-07-14 14:47:46 | 2023-07-14 14:47:47 |
Judging History
answer
#include <bits/stdc++.h>
const int N = 1e5 + 10;
char s[N];
int nxt[N];
int main(){
scanf("%d", s + 1);
int n = strlen(s + 1);
for(int i = 2, j = 0; i <= n; ++i){
while(j && s[j + 1] != s[i]) j = nxt[j];
if(s[j + 1] == s[i]) ++j;
nxt[i] = j;
}
for(int i = 1; i <= n; ++i) printf("%d%c", nxt[i], " \n"[i == n]);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3388kb
input:
mencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimen...
output:
result:
wrong answer Answer contains longer sequence [length = 100000], but output contains 0 elements