Submission #46322

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
463222018-04-19 06:26:30RayaBurong25_1Palindromes (APIO14_palindrome)C++17
47 / 100
1090 ms16072 KiB
#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])
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

palindrome.cpp: In function 'int main()':
palindrome.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", S);
     ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...