| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 578233 | andrei_boaca | Palindromic Partitions (CEOI17_palindromic) | C++14 | 10017 ms | 5420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
string s;
int t,n;
int getans(int l,int r)
{
if(l>r)
return 0;
for(int last=l;last<=r;last++)
{
int lg=last-l+1;
int poz=r-lg+1;
if(poz>last)
{
bool ok=1;
for(int i=l,j=poz;i<=last&&j<=r;i++,j++)
if(s[i]!=s[j])
{
ok=0;
break;
}
if(ok)
return 2+getans(last+1,poz-1);
}
}
return 1;
}
void solve()
{
cin>>s;
n=s.size();
s=" "+s;
cout<<getans(1,n)<<'\n';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>t;
while(t--)
solve();
return 0;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
