QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#340545 | #464. 前缀函数 / KMP | wtcqwq# | WA | 7ms | 4452kb | C++14 | 329b | 2024-02-29 09:59:11 | 2024-02-29 09:59:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=100009;
ll kmp[N];
int main(){
string b;
cin>>b;
b=" "+b;
ll j=0;
for(ll i=2;i<b.size();i++){
while(j!=0&&b[j+1]!=b[i]) j=kmp[j];
if(b[j+1]==b[i]){
j++;
kmp[i]=j;
}
}
for(ll i=0;i<b.size();i++) cout<<kmp[i]<<" ";
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 7ms
memory: 4452kb
input:
mencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimen...
output:
0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 6...
result:
wrong answer 6th numbers differ - expected: '1', found: '0'