# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95921 | Kastanda | Palindromic Partitions (CEOI17_palindromic) | C++11 | 923 ms | 129692 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>
using namespace std;
const int MXN = 1000006, SGM = 26;
int n, ts, link[MXN], len[MXN];
int slink[MXN], diff[MXN], sdp[MXN], dp[MXN];
map < int , int > C[MXN];
char S[MXN], _S[MXN];
inline int GetLink(int nw, int i)
{
while (S[i] != S[i - len[nw] - 1])
nw = link[nw];
return (nw);
}
inline int Add(int nw, int i)
{
int ch = S[i] - 'a';
nw = GetLink(nw, i);
if (!C[nw][ch])
{
ts ++;
len[ts] = len[nw] + 2;
link[ts] = C[GetLink(link[nw], i)][ch];
diff[ts] = len[ts] - len[link[ts]];
slink[ts] = link[ts];
if (diff[ts] == diff[link[ts]])
slink[ts] = slink[link[ts]];
C[nw][ch] = ts;
return (ts);
}
return (C[nw][ch]);
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... |