report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Palindromic quadruple - MarisaOJ: Marisa Online Judge

Palindromic quadruple

Time limit: 1000 ms
Memory limit: 512 MB
Let $S$ be a string consisting only of letters. Count the number of tuples $(i, j, k, t)$ such that $ 1 \leq i \leq j < k \leq t \leq |S|$ and $S[i..j] + S[k...t]$ is a palindrome. ### Input - Only line contains a string $S$. ### Output - Print the number of quadruples that satisfy the conditions. ### Constraints $|S| \le 5000 $ ### Example Input: ``` abbaca ``` Output: ``` 14 ```
Introduction to Dynamic Programming (Part two)
Sake game
Coins
Coins 2
Game on array
Longest increasing subsequence 2
Convolution
Regular bracket sequence
Faulty addition
Weird bank
Delete operation
Palindromize
Color ribbon
Unique subsequences
Unique subsequences 2
Cow exhibition
Knapsack 3
Compressing array
Regular bracket sequence 2
Maximum path 3
Concating substring
Soil
Stacking boxes
String transformation
Palindromic quadruple
Finding teammates
Topic
Dynamic Programming
String
Rating 1900
Solution (1) Solution