Submission #3862

#TimeUsernameProblemLanguageResultExecution timeMemory
3862gs13068Make superpalindrome! (kriii1_M)C++98
0 / 1
200 ms1180 KiB
#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 timeMemoryGrader output
Fetching results...