当前位置:网站首页>Codeforces Round #715 (Div. 2) D. Binary Literature
Codeforces Round #715 (Div. 2) D. Binary Literature
2022-07-05 05:27:00 【solemntee】
Because we know that there must be two strings in three strings 0 The number is greater than or less than n individual .
So we just choose two such strings , Let's see what's inside 0 perhaps 1 Become their common subsequence .
Just happy ac 了 , This is too water
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char s[4][200005];
bool visa[200005],visb[200005];
int n,cnt[4];
int judge(int a,int b)
{
// printf("%d %d %d %d %d\n",a,b,cnt[a],cnt[b],n);
if(cnt[a]>=n&&cnt[b]>=n)return 1;
else if(cnt[a]<=n&&cnt[b]<=n)return 2;
else return 0;
}
void print(int a,int b,int w)
{
// printf("%d %d %d\n",a,b,w);
char c;
if(w==1)c='0';
else c='1';
int pa=1,pb=1;
while(pa<=2*n||pb<=2*n)
{
if(s[a][pa]==c&&s[b][pb]==c&&pa<=2*n&&pb<=2*n)
{
printf("%c",c);
pa++,pb++;
}
else if(s[a][pa]!=c&&pa<=2*n)
{
printf("%c",s[a][pa]);
pa++;
}
else if(s[b][pb]!=c&&pb<=2*n)
{
printf("%c",s[b][pb]);
pb++;
}
else if(s[b][pb]==c&&pa>2*n)
{
printf("%c",c);
pb++;
}
else if(s[a][pa]==c&&pb>2*n)
{
printf("%c",c);
pa++;
}
}
printf("\n");
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=1;i<=3;i++)scanf("%s",s[i]+1);
for(int i=1;i<=3;i++)
{
cnt[i]=0;
for(int j=1;j<=2*n;j++)
{
if(s[i][j]=='0')cnt[i]++;
}
// cout<<cnt[i]<<endl;
}
for(int i=1;i<=3;i++)
for(int j=1;j<=3;j++)
{
if(i==j)continue;
if(judge(i,j))
{
print(i,j,judge(i,j));
goto endd;
}
}
endd:;
}
return 0;
}
边栏推荐
- [binary search] 69 Square root of X
- Bucket sort
- [转]MySQL操作实战(一):关键字 & 函数
- On-off and on-off of quality system construction
- [to be continued] [UE4 notes] L1 create and configure items
- [to be continued] [UE4 notes] L2 interface introduction
- TF-A中的工具介绍
- Yolov5 adds attention mechanism
- What is the agile proportion of PMP Exam? Dispel doubts
- Csp-j-2020-excellent split multiple solutions
猜你喜欢
GBase数据库助力湾区数字金融发展
On-off and on-off of quality system construction
对象的序列化
浅谈JVM(面试常考)
[trans]: spécification osgi
Romance of programmers on Valentine's Day
远程升级怕截胡?详解FOTA安全升级
[to be continued] [depth first search] 547 Number of provinces
Solution to the palindrome string (Luogu p5041 haoi2009)
剑指 Offer 53 - I. 在排序数组中查找数字 I
随机推荐
游戏商城毕业设计
Acwing 4300. Two operations
Merge sort
PMP考生,请查收7月PMP考试注意事项
The number of enclaves
Developing desktop applications with electron
Bubble sort summary
FVP和Juno平台的Memory Layout介绍
[转]MySQL操作实战(三):表联结
Binary search basis
Corridor and bridge distribution (csp-s-2021-t1) popular problem solution
质量体系建设之路的分分合合
第六章 数据流建模—课后习题
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
二十六、文件系统API(设备在应用间的共享;目录和文件API)
2022年上半年国家教师资格证考试
SSH password free login settings and use scripts to SSH login and execute instructions
对象的序列化
Reflection summary of Haut OJ freshmen on Wednesday
[turn]: OSGi specification in simple terms