2019年09月16日01時49分15秒に更新されたバージョンを表示しています.
最新のページはこちらをご覧ください.
Codeforces Round #585 DIV2 C問題 (1750pt)
Problem description
省略
省略
C++に変換後のコードはこちら
//no-unlocked
int N;
char S[200002], T[200002];
int ab[2d5], absz;
int ba[2d5], basz;
int ress, res1[2d5], res2[2d5];
{
rd(N,S,T);
rep(i,N){
if(S[i]=='a' && T[i]=='b') ab[absz++] = i;
if(S[i]=='b' && T[i]=='a') ba[basz++] = i;
}
if( (absz + basz)%2 ) wt(-1), return 0;
while(absz >= 2){
res1[ress] = ab[--absz];
res2[ress++] = ab[--absz];
}
while(basz >= 2){
res1[ress] = ba[--basz];
res2[ress++] = ba[--basz];
}
if(absz && basz){
res1[ress] = ab[0];
res2[ress++] = ab[0];
res1[ress] = ab[0];
res2[ress++] = ba[0];
}
wt(ress);
rep(i,ress) wt(res1[i]+1, res2[i]+1);
}
Current time: 2024年04月29日15時31分58秒
Last modified: 2019年09月16日01時49分15秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF585 CF_Div2_C
トップページに戻る
Logged in as: unknown user (not login)