| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1302402 | kawhiet | Palindromic Partitions (CEOI17_palindromic) | C++20 | 10089 ms | 3276 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
void solve() {
string a;
cin >> a;
int n = a.size();
int ans = 0;
string pre, suf;
int l = 0, r = n - 1;
while (l < r) {
pre += a[l++];
suf += a[r--];
string tmp = suf;
reverse(tmp.begin(), tmp.end());
if (pre == tmp) {
ans += 2;
pre.clear();
suf.clear();
}
}
if (l <= r || !pre.empty()) {
ans++;
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}| # | 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... | ||||
