QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789936 | #9621. 连方 | NULL_SF | WA | 1ms | 3528kb | C++17 | 2.4kb | 2024-11-27 22:56:22 | 2024-11-27 22:56:24 |
Judging History
answer
#include <iostream>
using namespace std;
void solve()
{
int n,k3,k5;
string s1,s7,s2,s6;
cin>>n>>s1>>s7;
s2.resize(n);
s6.resize(n);
//特判全空
bool f=true;
for(auto c:s1)
{
if(c=='#') f=false;
}
if(f)
{
cout<<"Yes\n";
for(int i=1;i<=5;i++){
for(int j=0;j<n;j++) cout<<'.';
cout<<'\n';
}
for(auto c:s7){
if(c=='.') cout<<'#';
else cout<<'.';
}
cout<<'\n';
for(auto c:s7){
cout<<c;
}
cout<<'\n';
return;
}
f=true;
for(auto c:s7)
{
if(c=='#') f=false;
}
if(f)
{
cout<<"Yes\n";
for(auto c:s1){
cout<<c;
}
cout<<'\n';
for(auto c:s1){
if(c=='.') cout<<'#';
else cout<<'.';
}
cout<<'\n';
for(int i=1;i<=5;i++){
for(int j=0;j<n;j++) cout<<'.';
cout<<'\n';
}
return;
}
int cnt1=0;
for(auto c:s1)
{
cnt1+=c=='.';
}
int cnt2=0;
for(auto c:s2)
{
cnt2+=c=='.';
}
if(cnt1==0 || cnt2==0)
{
if(cnt1==0 && cnt2==0)
{
cout<<"Yes\n";
for(int i=1;i<=7;i++){
for(int j=0;j<n;j++) cout<<'#';
cout<<'\n';
}
}
else
{
cout<<"No\n";
}
return;
}
for(int i=0;i<n;i++)
{
if(s1[i]=='#') s2[i]='.';
else s2[i]='#';
if(s7[i]=='#') s6[i]='.';
else s6[i]='#';
}
bool flag=true;
for(int i=0;i<n && flag;i++){
if((s2[i]=='.' && (i==0 || s2[i-1]=='#') && (i==n-1 || s2[i+1]=='#')) || (s2[i]=='#' && (i==0 || s2[i-1]=='.') && (i==n-1 || s2[i+1]=='.')))
{
flag=false;
k3=i;
}
}
if(flag)
{
cout<<"No\n";
return;
}
flag=true;
for(int i=0;i<n && flag;i++){
if((s6[i]=='.' && (i==0 || s6[i-1]=='#') && (i==n-1 || s6[i+1]=='#')) || (s6[i]=='#' && (i==0 || s6[i-1]=='.') && (i==n-1 || s6[i+1]=='.')))
{
flag=false;
k5=i;
}
}
if(flag)
{
cout<<"No\n";
return;
}
cout<<"Yes\n";
cout<<s1<<'\n'<<s2<<'\n';
for(int i=0;i<n;i++){
if(i==k3) cout<<'#';
else cout<<'.';
}
cout<<'\n';
for(int i=0;i<n;i++){
if(i==k3 && k3==k5) cout<<'#';
else if(i>min(k3,k5) && i<max(k3,k5)) cout<<'#';
else cout<<'.';
}
cout<<'\n';
for(int i=0;i<n;i++){
if(i==k5) cout<<'#';
else cout<<'.';
}
cout<<'\n';
cout<<s6<<'\n'<<s7<<'\n';
return;
}
signed main()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3528kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
No No Yes ###### ###### ###### ###### ###### ###### ###### No Yes ########## ########## ########## ########## ########## ########## ##########
result:
wrong answer Testcase 1: output is NO, but jury's answer is YES.