Submission #3862

# Submission time Handle Problem Language Result Execution time Memory
3862 2013-08-31T08:56:02 Z gs13068 Make superpalindrome! (kriii1_M) C++
0 / 1
200 ms 1180 KB
#include<cstdio>
#include<cstring>

char str[100001];

void dfs(int l,int r)
{
	if(r-l==1)return;
	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
1 Execution timed out 200 ms 1180 KB Program timed out
2 Halted 0 ms 0 KB -