# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397369 | 2021-05-02T01:40:29 Z | Pichon5 | Palindromic Partitions (CEOI17_palindromic) | C++17 | 2 ms | 588 KB |
#include <iostream> #include <bits/stdc++.h> #define pb push_back using namespace std; int dp[301][301]; string s; int f(int b, int e){ if(e<b)return 0; if(b==e)return 1; if(dp[b][e]!=-1)return dp[b][e]; dp[b][e]=1; for(int i=1;i<=e-b+1;i++){ if(i+i>e-b+1)break; string A=s.substr(b,i); string B=s.substr(e-i+1,i); if(A==B){ dp[b][e]+=1+f(b+i,e-i); } } return dp[b][e]; } void init(){ for(int i=0;i<=300;i++){ for(int l=0;l<=300;l++)dp[i][l]=-1; } } int main() { int n,t; cin>>t; while(t--){ cin>>s; init(); int n=s.size(); cout<<f(0,n-1)<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |