Submission #1103881

# Submission time Handle Problem Language Result Execution time Memory
1103881 2024-10-22T06:19:06 Z ezzzay Palindromic Partitions (CEOI17_palindromic) C++14
0 / 100
1 ms 336 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
vector<int>ans;
void fun(){
    string s;
    cin>>s;
    int n=s.size();
    int l=0,r=n-1;
    string a,b;
    int cnt=0;
    while(r>l){
        a+=s[l];
        b=s[r]+b;
        if(a==b){
            a.clear();
            b.clear();
            cnt+=2;
        }
        r--;
        l++;
    }
    if(n%2==0 and s[n/2]==s[n/2-1])cnt--;
    ans.pb(cnt+1);
}
signed main(){
    int t;
    cin>>t;
    while(t--)fun();
    for(auto a:ans)cout<<a<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -