QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#776511 | #9621. 连方 | ucup-team3548# | AC ✓ | 7ms | 4448kb | C++20 | 2.8kb | 2024-11-23 19:10:56 | 2024-11-23 19:10:56 |
Judging History
answer
#include<bits/stdc++.h>
#define lf double
using namespace std;
int T;
int N;
char Ans[8][100010];
void Solve()
{
scanf("%d",&N);
scanf("%s%s",Ans[1]+1,Ans[7]+1);
int Cntl=0,Cntr=0;
for(int i=1;i<=N;++i)
{
Cntl+=(Ans[1][i]=='.');
Cntr+=(Ans[7][i]=='.');
}
if(!Cntl||!Cntr)
{
if(!Cntl&&!Cntr)
{
puts("Yes");
for(int j=1;j<8;++j)
{
for(int i=1;i<=N;++i)
putchar('#');
putchar('\n');
}
}
else puts("No");
return;
}
puts("Yes");
for(int i=1;i<=N;++i)
{
Ans[2][i]=(Ans[1][i]=='#'?'.':'#');
Ans[6][i]=(Ans[7][i]=='#'?'.':'#');
Ans[4][i]=(i==1?'#':'.');
}
if(Ans[1][1]=='#')
{
Ans[3][1]='.';
if(Ans[1][2]=='#')
{
for(int i=2;i<=N;++i)
{
if(Ans[2][i]=='.')
Ans[3][i]='#';
else
{
for(int j=i;j<=N;++j)
Ans[3][j]='.';
break;
}
}
}
else
{
for(int i=2;i<=N;++i)
{
if(Ans[2][i]=='#')
Ans[3][i]='#';
else
{
for(int j=i;j<=N;++j)
Ans[3][j]='.';
break;
}
}
}
}
else
{
Ans[3][1]='#';
for(int i=2;i<=N;++i)
Ans[3][i]='.';
if(Ans[1][2]=='.')
Ans[2][1]='.';
}
if(Ans[7][1]=='#')
{
Ans[5][1]='.';
if(Ans[7][2]=='#')
{
for(int i=2;i<=N;++i)
{
if(Ans[6][i]=='.')
Ans[5][i]='#';
else
{
for(int j=i;j<=N;++j)
Ans[5][j]='.';
break;
}
}
}
else
{
for(int i=2;i<=N;++i)
{
if(Ans[6][i]=='#')
Ans[5][i]='#';
else
{
for(int j=i;j<=N;++j)
Ans[5][j]='.';
break;
}
}
}
}
else
{
Ans[5][1]='#';
for(int i=2;i<=N;++i)
Ans[5][i]='.';
if(Ans[7][2]=='.')
Ans[6][1]='.';
}
for(int j=1;j<8;++j)
{
for(int i=1;i<=N;++i)
putchar(Ans[j][i]);
putchar('\n');
}
}
int main()
{
scanf("%d",&T);
while(T--)
{
Solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3752kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. .##. #... #... #..# .##. Yes ##.#. ..#.# .#... #.... #.... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... #.......................... #.......................... #.......................... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 3ms
memory: 3688kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
Yes .#..## #.##.. #..... #..... #..... .#.### ..#... Yes #..#. .##.# .##.. #.... .#... ..### ##... Yes .###.# #...#. #..... #..... #..... .##... ...### Yes .####..#######..# #....##.......##. #................ #................ .##########...... ...........#..... ###########.##### Yes ..##.# .#..#. ...
result:
ok Correct.
Test #3:
score: 0
Accepted
time: 3ms
memory: 3888kb
input:
10000 41 #######.#######.######################### ################.###.#######.############ 6 ..#..# #..##. 6 #.#... #...#. 6 .#.##. ....## 6 ...#.# ##..#. 33 #####.########################### ###########.##################### 6 .##.## .##.#. 5 ..##. ####. 17 #.###.##########. ####.##.#####.##. 5 ....
output:
Yes #######.#######.######################### .......#.......#......................... .######.................................. #........................................ .###############......................... ................#...#.......#............ ################.###.#######.############ Ye...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 7ms
memory: 3740kb
input:
10000 6 ..#### .#.... 6 ...#.# #..##. 9 ..####.## ######..# 33 #######################.#####..## ######.######.###########.####### 6 ####.# #..##. 6 ...### ##.### 25 ######.#.#.############## .#########.##########.### 17 ############.#### ###############.# 6 #..#.# #####. 6 .#.### ..#... 49 ########...
output:
Yes ..#### .#.... #..... #..... #..... #.#### .#.... Yes ...#.# .##.#. #..... #..... .##... .##..# #..##. Yes ..####.## .#....#.. #........ #........ .#####... ......##. ######..# Yes #######################.#####..## .......................#.....##.. .######################.......... #................
result:
ok Correct.
Test #5:
score: 0
Accepted
time: 7ms
memory: 3700kb
input:
10000 5 ...#. ##### 6 ###... ##..#. 9 .#.###### #.#..#### 49 ######.########################################## ########.#############.########################## 41 ###########.#######.##################### ##############.########################## 6 ###..# ###.## 49 #################################...
output:
No Yes ###... ...### .##... #..... .#.... ..##.# ##..#. Yes .#.###### #.#...... #........ #........ .#....... .#.##.... #.#..#### Yes ######.########################################## ......#.......................................... .#####........................................... #..................
result:
ok Correct.
Test #6:
score: 0
Accepted
time: 6ms
memory: 4396kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 6ms
memory: 4448kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.