# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3868 | gs13068 | Make superpalindrome! (kriii1_M) | C++98 | 200 ms | 1180 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<cstdio>
#include<cstring>
char str[100001];
void dfs(int l,int r)
{
if(r-l==1)return;
if(r-l>3)
{
if((r-l)%2)
{
dfs(l,(l+r-1)/2);
dfs((l+r+1)/2,r);
}
else
{
dfs(l,(l+r)/2);
dfs((l+r)/2,r);
}
}
int i;
for(i=0;i<(l+r)/2;i++)
{
if(str[i]<str[r-i-1])
str[i]=str[r-i-1];
else
str[r-i-1]=str[i];
}
}
int main()
{
scanf("%s",str);
dfs(0,strlen(str));
puts(str);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |