# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
606905 | pakhomovee | Palindromic Partitions (CEOI17_palindromic) | C++17 | 10080 ms | 6408 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void solve() {
string s;
cin >> s;
int i = 0;
int ans = 0;
while (i <= (s.size() - 1) / 2) {
int len = 1;
bool ok = false;
for (; i + len <= s.size() / 2; ++len) {
if (s.substr(i, len) == s.substr(s.size() - i - len, len)) {
ok = true;
break;
}
}
i += len;
ans += 1 + ok;
}
cout << ans << '\n';
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |