QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#342926#464. 前缀函数 / KMPNetwork_Error#WA 1ms5548kbC++14771b2024-03-01 19:39:032024-03-01 19:39:04

Judging History

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

  • [2024-03-01 19:39:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5548kb
  • [2024-03-01 19:39:03]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define piii tuple<int, int, int>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define deb(x) cerr << #x << '=' << x << "; "
#define int long long
namespace loser {
	int n, m, bor[1000010];
	char s[1000010], t[1000010];
	void main() {

		m = strlen(t + 1);
		bor[1] = 0;
		for (int i = 2; i <= m; i++) {
			bor[i] = bor[i - 1];
			while (bor[i] && t[bor[i] + 1] != t[i]) bor[i] = bor[bor[i]];
			if (t[bor[i] + 1] == t[i]) bor[i]++;
		}
		for (int i = 1; i <= m; i++) cout << bor[i] << ' ';
	}
}
signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T = 1; while (T--) loser::main(); return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5548kb

input:

mencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimencimencimencimencimenciyvdfitnmencimencimencimen...

output:


result:

wrong answer Answer contains longer sequence [length = 100000], but output contains 0 elements