QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#342926 | #464. 前缀函数 / KMP | Network_Error# | WA | 1ms | 5548kb | C++14 | 771b | 2024-03-01 19:39:03 | 2024-03-01 19:39:04 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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