Codeforces Global Round 4 E問題 (2000pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
char S[1000002]; int N;
char res[1000002]; int len;
char tmp[1000002]; int tmps;
{
int i, j, k;
int a, b;
rd(S@N);
a = 0;
b = N-1;
while(a <= b){
if(a==b){
res[len++] = S[a];
break;
}
if(S[a]==S[b]){
res[len++] = S[a];
tmp[tmps++] = S[b];
a++; b--;
continue;
}
if(S[a+1] == S[b]){
a++; continue;
}
if(S[a] == S[b-1]){
b--; continue;
}
a++; b--;
}
while(tmps) res[len++] = tmp[--tmps];
wt(res);
}
Current time: 2024年04月25日04時03分06秒
Last modified: 2019年07月21日15時47分06秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces Codeforces_Global_Round_4
トップページに戻る
Logged in as: unknown user (not login)