Submission #916284

#TimeUsernameProblemLanguageResultExecution timeMemory
916284vjudge1Palindromic Partitions (CEOI17_palindromic)Cpython 2
Compilation error
0 ms0 KiB
def is_palindrome(s): return s == s[::-1] def max_palindromic_partition(s): n = len(s) dp = [0] * n for i in range(n): max_partition = 0 for j in range(i+1): if is_palindrome(s[j:i+1]): max_partition = max(max_partition, 1 + (dp[j-1] if j > 0 else 0)) dp[i] = max_partition return dp[n-1] # Input t = int(input()) for _ in range(t): s = input().strip() # Output print(max_palindromic_partition(s)))

Compilation message (stderr)

File "palindromic.py", line 20
    print(max_palindromic_partition(s)))
                                       ^
SyntaxError: invalid syntax