Codeforces Round #582 DIV3 E問題
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
int N;
char S[4], T[4];
char res[300002]; int ress;
int is_ok(void){
rep(i,1,3N){
if(res[i-1]==S[0] && res[i]==S[1]) return 0;
if(res[i-1]==T[0] && res[i]==T[1]) return 0;
}
return 1;
}
{
int i, k;
int ind[3];
rd(N,S,T);
wt("YES");
rep(i,3) ind[i] = i;
do{
ress = 0;
rep(k,3) rep(i,N) res[ress++] = 'a' + ind[k];
if(is_ok()) wt(res), return 0;
}while(next_permutation(ind,ind+3));
do{
ress = 0;
rep(i,N) rep(k,3) res[ress++] = 'a' + ind[k];
if(is_ok()) wt(res), return 0;
}while(next_permutation(ind,ind+3));
}
Current time: 2024年03月29日18時06分46秒
Last modified: 2019年09月01日00時52分10秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF582 CF_Div3_E
トップページに戻る
Logged in as: unknown user (not login)