# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
468962 | 2021-08-30T09:51:18 Z | Josia | Palindromic Partitions (CEOI17_palindromic) | C++14 | 1 ms | 204 KB |
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx2") #include <bits/stdc++.h> #define int int64_t using namespace std; signed main() { cin.tie(0); ios_base::sync_with_stdio(0); int n; cin >> n; while (n--) { string s; cin >> s; int pos = 0; int res = 0; while (pos<=s.size()/2) { bool worksOuter = 0; for (int i = 1; i<=(s.size()-2*pos)/2; i++) { bool works = 1; for (int j = 0; j<i; j++) { if (s[j+pos] != s[s.size()-pos-i+j]) { works = 0; break; } } if (works) { // cout << pos << " " << i << "\n"; worksOuter = 1; pos += i; res+=2; break; } } if (!worksOuter) { res++; break; } } cout << res << "\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |