QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#772473 | #9621. 连方 | candy34# | WA | 0ms | 3628kb | C++20 | 2.5kb | 2024-11-22 19:45:03 | 2024-11-22 19:45:03 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define ph push_back
#define pp pop_back
using namespace std;
const int N=2e5+5;
int T,n;
string a,b,ans[10];
string fa,fb;
bool jing(const string &str)
{
for(auto ch:str)
if(ch=='.') return 0;
return 1;
}
bool dian(const string &str)
{
for(auto ch:str)
if(ch=='#') return 0;
return 1;
}
bool solve()
{
if(jing(a)&&jing(b))
{
for(int i=1;i<=7;i++) ans[i]=a;
return 1;
}
if(dian(a)||dian(b))
{
if(a==b)
{
for(int i=1;i<=7;i++) ans[i]=a;
return 1;
}
if(dian(a)&&jing(b))
{
for(int i=1;i<=6;i++) ans[i]=a;
ans[7]=b;
}
if(dian(a)&&!jing(b))
{
ans[7]=b; ans[6]=fb;
for(int i=1;i<=5;i++) ans[i]=a;
}
if(jing(a)&&dian(b))
{
ans[1]=a;
for(int i=2;i<=7;i++) ans[i]=b;
}
if(!jing(a)&&dian(b))
{
ans[1]=a; ans[2]=fa;
for(int i=3;i<=7;i++) ans[i]=b;
}
return 1;
}
if(!jing(a)&&!jing(b))
{
if(fa==b)
{
ans[1]=a;
for(int i=2;i<=7;i++) ans[i]=b;
return 1;
}
ans[1]=a; ans[2]=fa; ans[7]=b; ans[6]=fb;
vector<bool>pd(n+5);
bool fg=0;
for(int i=0;i<n;i++)
if(a[i]=='.'&&b[i]=='.') fg=1,pd[i]=1;
if(!fg)
{
ans[3]=fa; ans[5]=fb;
ans[4].resize(n+1);
for(int i=0;i<n;i++)
if(fa[i]=='.'&&fb[i]=='.') ans[4][i]='#';
else ans[4][i]='.';
}
else
{
ans[3]=a; ans[5]=b;
ans[4].resize(n+1);
for(int i=0;i<n;i++)
if(pd[i]) ans[4][i]='#';
else ans[4][i]='.';
}
return 1;
}
return 0;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>T;
while(T--)
{
cin>>n>>a>>b;
fa.clear(); fb.clear();
for(int i=0;i<n;i++)
{
if(a[i]=='#') fa.ph('.');
else fa.ph('#');
if(b[i]=='#') fb.ph('.');
else fb.ph('#');
}
if(!solve()) cout<<"No\n";
else
{
cout<<"Yes\n";
for(int i=1;i<=7;i++) cout<<ans[i]<<endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. .##. .##. .##. .##. .##. Yes ##.#. ..#.# ##.#. ..#..
result:
wrong answer Token parameter [name=map] equals to "..#..~", doesn't correspond to pattern "[\.#]{1,100000}"