P7939 [B1] Alice Wins! (easy version)题解
思路:
为了使 这不是废话吗),那么最好将
代码:
#include<bits/stdc++.h>
#define ll long long
#define un unsigned
using namespace std;
inline int read(){//快读
int x=0,y=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')y=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
return x*y;
}
inline void write(int x){//快输
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+48);
return;
}
int a[1000010],b[1000010],n,m;
int main(){
n=read();
for(int i=0;i<n;i++){
m=read();//输入
int M=m<<1;
for(int j=0;j<M;j++)a[j]=read();
for(int j=0;j<M;j++)b[j]=read();
write(M),putchar('\n');//输出
for(int j=0;j<M;j++){
if(j<m)//使A队前n个人赢
if(b[j]==1) a[j]=3;
else if(b[j]==2) a[j]=1;
else a[j]=2;
write(a[j]),putchar(' ');//输出
}
putchar('\n');
for(int j=0;j<M;j++){
if(j>=m)//使B队后n个人输
if(a[j]==1) b[j]=2;
else if(a[j]==2) b[j]=3;
else b[j]=1;
write(b[j]),putchar(' ');//输出
}
putchar('\n');
}
return 0;
}