# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
46322 | RayaBurong25_1 | Palindromes (APIO14_palindrome) | C++17 | 1090 ms | 16072 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 <stdio.h>
#include <map>
#define MOD 1000000007LL
char S[300005];
std::map<int, int> Map[300005];
int isPalin[2][300005];
int Ans = 0;
int main()
{
scanf("%s", S);
int N;
for (N = 0; S[N] != '\0'; N++);
int i, j;
long long Hash;
std::map<int, int>::iterator it;
for (i = N - 1; i >= 0; i--)
{
Hash = 0;
for (j = i; j < N; j++)
{
Hash = (Hash*26 + S[j] - 'a')%MOD;
if (j == i)
{
isPalin[i%2][j] = 1;
Map[j - i + 1][Hash]++;
it = Map[j - i + 1].find(Hash);
if (it->second*(j - i + 1) > Ans)
Ans = it->second*(j - i + 1);
}
else if (j == i + 1 && S[i] == S[j])
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... |