Submission #858402

# Submission time Handle Problem Language Result Execution time Memory
858402 2023-10-08T11:22:27 Z Tenis0206 Palindromic Partitions (CEOI17_palindromic) C++11
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

string s;

int solve(int st, int dr)
{
    for(int len=1;st + len - 1 < dr - len + 1;len++)
    {
        bool ok = true;
        for(int i=1;i<=len;i++)
        {
            if(s[st + i - 1] != s[dr - len + i])
            {
                ok = false;
                break;
            }
        }
        if(ok)
        {
            return 2 + solve(st + len, dr - len);
        }
    }
    return 1;
}

void solve_test()
{
    cin>>s;
    s = "#" + s;
    cout<<solve(1,s.size() - 1)<<'\n';
}

int main()
{
    int t;
    cin>>t;
    for(int test=1;test<=t;test++)
    {
        solve_test();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -