QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#794750 | #9621. 连方 | FHQY | AC ✓ | 13ms | 4472kb | C++23 | 1.7kb | 2024-11-30 15:48:18 | 2024-11-30 15:48:19 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define endl '\n'
using namespace std;
const int N=1e5+5;
int n;
string a,b;
char c[10][N];
void pri()
{
cout<<"Yes"<<endl;
for(int i=1;i<=7;i++)
{
for(int j=1;j<=n;j++)
cout<<c[i][j];
cout<<endl;
}
return;
}
bool check()
{
}
void solve(){
cin>>n>>a>>b;
int c1=0,c2=0;
for(int i=1;i<=7;i++)
for(int j=1;j<=n;j++)
c[i][j]='.';
for(int i=1;i<=n;i++)
c1+=(a[i-1]=='#'),c2+=(b[i-1]=='#');
if(c1==n||c2==n){
if(c1==n&&c2==n){
cout<<"Yes"<<endl;
for(int i=1;i<=7;i++){
for(int j=1;j<=n;j++)
cout<<'#';
cout<<endl;
}
}else cout<<"No"<<endl;
return;
}
for(int i=1;i<=n;i++)c[1][i]=a[i-1];
for(int i=1;i<=n;i++)c[7][i]=b[i-1];
for(int i=1;i<=n;i++){
c[2][i]=(c[1][i]=='#'?'.':'#');
c[6][i]=(c[7][i]=='#'?'.':'#');
}
int p1,p2;
for(int i=1;i<=n;i++)
{
if(c[2][i]=='.'&&((i+1<=n&&c[2][i+1]=='#')||(i-1>=1&&c[2][i-1]=='#')))
{
c[3][i]='#';
p1=i;
break;
}
}
for(int i=1;i<=n;i++)
{
if(c[6][i]=='.'&&((i+1<=n&&c[6][i+1]=='#')||(i-1>=1&&c[6][i-1]=='#')))
{
c[5][i]='#';
p2=i;
break;
}
}
if(p1>p2)
swap(p1,p2);
if(p1==p2)
c[4][p1]='#';
else if(p1+1==p2)
{
c[4][p1]='#';
}
else
{
for(int i=p1+1;i<p2;i++)
c[4][i]='#';
}
pri();
}
int T=1;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>T;
for(int kase=1;kase<=T;kase++){
solve();
}
return 0;
}
/*
4
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####
*/
/*
1
6
.####.
..##..
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3748kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #... #... .#.. #..# .##. Yes ##.#. ..#.# .#... .#... .#... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... .#......................... .#......................... .#......................... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 12ms
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: 13ms
memory: 3676kb
input:
10000 41 #######.#######.######################### ################.###.#######.############ 6 ..#..# #..##. 6 #.#... #...#. 6 .#.##. ....## 6 ...#.# ##..#. 33 #####.########################### ###########.##################### 6 .##.## .##.#. 5 ..##. ####. 17 #.###.##########. ####.##.#####.##. 5 ....
output:
Yes #######.#######.######################### .......#.......#......................... ......#.................................. .......########.......................... ...............#......................... ................#...#.......#............ ################.###.#######.############ Ye...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 8ms
memory: 3736kb
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: 12ms
memory: 3684kb
input:
10000 5 ...#. ##### 6 ###... ##..#. 9 .#.###### #.#..#### 49 ######.########################################## ########.#############.########################## 41 ###########.#######.##################### ##############.########################## 6 ###..# ###.## 49 #################################...
output:
No Yes ###... ...### ..#... .#.... .#.... ..##.# ##..#. Yes .#.###### #.#...... .#....... #........ #........ .#.##.... #.#..#### Yes ######.########################################## ......#.......................................... .....#........................................... ......#............
result:
ok Correct.
Test #6:
score: 0
Accepted
time: 10ms
memory: 4460kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 11ms
memory: 4472kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.