QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#92688#464. 前缀函数 / KMPcp152#WA 7ms4124kbC++14307b2023-03-30 20:54:212023-03-30 20:54:22

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-30 20:54:22]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:4124kb
  • [2023-03-30 20:54:21]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
char c[100005];
int f[100005];
int main()
{
	scanf("%s",c+1);
	for(int i=2;c[i];i++)
	{
		int ls=f[i-1];
		while(ls&&c[ls+1]!=c[i])
			ls=f[ls];
		if(c[ls+1]==c[i])	f[i]=ls+1;
		cout<<f[i]<<' ';
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 7ms
memory: 4124kb

input:

mencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimen...

output:

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 63 64...

result:

wrong answer 5th numbers differ - expected: '0', found: '1'