# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493435 | JovanB | Palindromes (APIO14_palindrome) | C++17 | 2 ms | 1360 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 PRINT(x) cerr<<#x<<'='<<x<<endl;
using namespace std;
struct PalTree {
#define P_SIGMA 26
#define FIRST_NODE 1
#define SECOND_NODE 2
struct Node {
int len, cnt, dub, slink;
int to[P_SIGMA];
Node() { len = cnt = dub = slink = 0; for(int i = 0; i < P_SIGMA; i++) to[i] = 0; }
Node(int _len, int _cnt, int _dub, int _slink) {
len = _len; cnt = _cnt; dub = _dub; slink = _slink;
for(int i = 0; i < P_SIGMA; i++) to[i] = 0;
}
};
string s;
vector<Node> pt;
int suff;
int toidx(char c) { return c-'a'; }
void addLetter(char c) {
s += c; int len = s.size();
assert(0 <= len-2-pt[suff].len);
while(c != s[len-2-pt[suff].len]) {
suff = pt[suff].slink;
}
int nd = pt[suff].to[toidx(c)];
if(nd == 0) {
nd = pt.size();
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... |