# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290394 | ZwariowanyMarcin | Palindromes (APIO14_palindrome) | C++17 | 30 ms | 34944 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ss(x) (int) x.size()
#define cat(x) cerr << #x << " = " << x << endl
using ll = long long;
using namespace std;
const int N = 3e5 + 100;
const int A = 26;
int cnt, len[N], link[N], last, nxt[N][A], q[N];
char s[N];
void add(int x) {
int v = last, c = s[x] - 'a';
while (s[x] != s[x - len[v] - 1]) v = link[v];
if (!nxt[v][c]) {
int ja = ++cnt, k = link[v];
len[ja] = len[v] + 2;
while (s[x] != s[x - len[k] - 1]) k = link[k];
link[ja] = nxt[k][c], nxt[v][c] = ja;
}
q[nxt[v][c]]++;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |