当前位置:网站首页>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;
}
边栏推荐
- 二十六、文件系统API(设备在应用间的共享;目录和文件API)
- Pointnet++学习
- Solon Auth 认证框架使用演示(更简单的认证框架)
- Find a good teaching video for Solon framework test (Solon, lightweight application development framework)
- [allocation problem] 135 Distribute candy
- Support multi-mode polymorphic gbase 8C database continuous innovation and heavy upgrade
- Haut OJ 1401: praise energy
- [turn]: OSGi specification in simple terms
- [turn to] MySQL operation practice (III): table connection
- [speed pointer] 142 circular linked list II
猜你喜欢
On-off and on-off of quality system construction
A new micro ORM open source framework
远程升级怕截胡?详解FOTA安全升级
[speed pointer] 142 circular linked list II
Embedded database development programming (VI) -- C API
lxml. etree. XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
挂起等待锁 vs 自旋锁(两者的使用场合)
浅谈JVM(面试常考)
剑指 Offer 09. 用两个栈实现队列
剑指 Offer 04. 二维数组中的查找
随机推荐
SAP-修改系统表数据的方法
Animation scoring data analysis and visualization and it industry recruitment data analysis and visualization
Acwing 4301. Truncated sequence
远程升级怕截胡?详解FOTA安全升级
Merge sort
[binary search] 34 Find the first and last positions of elements in a sorted array
Warning using room database: schema export directory is not provided to the annotation processor so we cannot export
Solution to the palindrome string (Luogu p5041 haoi2009)
What is the agile proportion of PMP Exam? Dispel doubts
每日一题-无重复字符的最长子串
浅谈JVM(面试常考)
Haut OJ 2021 freshmen week II reflection summary
Find a good teaching video for Solon framework test (Solon, lightweight application development framework)
质量体系建设之路的分分合合
[轉]: OSGI規範 深入淺出
PMP candidates, please check the precautions for PMP examination in July
kubeadm系列-02-kubelet的配置和启动
Summary of Haut OJ 2021 freshman week
TF-A中的工具介绍
[turn to] MySQL operation practice (III): table connection