# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
309820 | 2020-10-04T15:19:58 Z | peuch | Palindromic Partitions (CEOI17_palindromic) | C++17 | 10000 ms | 256 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; int t; string st1, st2; vector<string> part; int ans; void bt(int cur); int main(){ scanf("%d", &t); while(t--){ ans = 0; cin >> st1; bt(0); printf("%d\n", ans); } } void bt(int cur){ if(cur == st1.size()){ if(st2.size() != 0) part.push_back(st2); int tam = part.size(); int cnt = 0; bool flag = 1; for(int i = 0; i < tam / 2; i++){ if(part[i] == part[tam - i - 1]) cnt += 2; else flag = 0; } cnt++; if(flag) { ans = max(ans, cnt); } if(st2.size() != 0) part.pop_back(); return; } string aux = st2; st2 += st1[cur]; part.push_back(st2); st2 = ""; bt(cur + 1); st2 = part[part.size() - 1]; part.pop_back(); bt(cur + 1); st2 = aux; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 10067 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 10067 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 10067 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 10067 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |