ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1297. Palindrome

Memory Limit Exceeded, Test15
Posted by Александр 5 Sep 2017 20:56
My code in python 3.6:

def is_palindrom(x):
    if x==x[::-1]:
        return True
    return False

s=input()
s=s[::-1]
n=len(s)
a=[]
for x in range(2,n+1):
    for i in range(0,n-x+1):
        if is_palindrom(s[i:i+x]):
            a.append(s[i:i+x])
if len(a)==0:
    b=s[-1]
else:
    b=a[-1]
print(b)

Memory is 70160 Kb, where so much it?
Please, help, I would be grateful!
Re: Memory Limit Exceeded, Test15
Posted by Mahilewets Nikita [BSUIR] 5 Sep 2017 22:27
I see you AC now

What was the issue?
Re: Memory Limit Exceeded, Test15
Posted by Mahilewets Nikita [BSUIR] 5 Sep 2017 22:28
Oh, sorry, it is other task
Re: Memory Limit Exceeded, Test15
Posted by Mahilewets Nikita [BSUIR] 5 Sep 2017 22:40
https://ideone.com/xIjb6n
I have corrected your code.