QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789910 | #9621. 连方 | NULL_SF | WA | 1ms | 3596kb | C++17 | 1.9kb | 2024-11-27 22:41:12 | 2024-11-27 22:41:13 |
Judging History
answer
#include <iostream>
using namespace std;
void solve()
{
int n,k3,k5;
string s1,s7,s2,s6;
cin>>n>>s1>>s7;
s2.reserve(n+1);
s6.reserve(n+1);
//特判全空
bool f=true;
for(auto c:s1)
{
if(c=='#') f=false;
}
if(f)
{
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)
{
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;
}
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<<s1<<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<<s7<<'\n';
return;
}
signed main()
{
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: 3596kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
#..# #... #... #... .##. ##.#. ..#.. .#... #.... .#.## No .######.######.####.#.##### #.......................... #.......................... #.......................... .####...####..#.......##### No
result:
wrong answer Testcase 1: output is #..#, but jury's answer is YES.