QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747481 | #9621. 连方 | Microperson# | AC ✓ | 12ms | 11704kb | C++20 | 2.2kb | 2024-11-14 17:17:18 | 2024-11-14 17:17:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1000007;
char arr[10][N];
void solve( ){
int n;
cin >> n;
string a,b;
cin >> a>> b;
if(b.find("#")==string::npos||a.find("#")==string::npos){
cout<<"Yes\n";
cout<<a<<'\n';
for(int i=1;i<6;i++){
for(int j=0;j<n;j++){
cout<<'.';
}
cout<<'\n';
}
cout<<b<<'\n';
return;
}
if(b.find(".")==string::npos||a.find(".")==string::npos){
if(b.find(".")==string::npos&&a.find(".")==string::npos){
cout<<"Yes\n";
for(int i=0;i<7;i++){
for(int i=0;i<n;i++){
cout<<'#';
}
cout<<'\n';
}
}else{
cout<<"No\n";
}
return;
}
for(int i=1;i<=n;i++){
arr[1][i]=a[i-1];
arr[7][i]=b[i-1];
}
for(int i=1;i<=n;i++){
if(arr[1][i]=='.')arr[2][i]='#';
else arr[2][i]='.';
if(arr[7][i]=='.')arr[6][i]='#';
else arr[6][i]='.';
}
int aa=0,bb=0;
for(int i=1;i<n;i++){
if(arr[2][i]=='.'&&arr[2][i+1]=='#'){
arr[3][i]='#';
aa=i;
for(int j=1;j<=n;j++){
if(j==i)continue;
arr[3][j]='.';
}
break;
}else if(arr[2][i]=='#'&&arr[2][i+1]=='.'){
arr[3][i+1]='#';
aa=i+1;
for(int j=1;j<=n;j++){
if(j==i+1)continue;
arr[3][j]='.';
}
break;
}
}
for(int i=1;i<n;i++){
if(arr[6][i]=='.'&&arr[6][i+1]=='#'){
arr[5][i]='#';
bb=i;
for(int j=1;j<=n;j++){
if(j==i)continue;
arr[5][j]='.';
}
break;
}else if(arr[6][i]=='#'&&arr[6][i+1]=='.'){
arr[5][i+1]='#';
bb=i+1;
for(int j=1;j<=n;j++){
if(j==i+1)continue;
arr[5][j]='.';
}
break;
}
}
for(int i=1;i<=n;i++){
if(i>min(aa,bb)&&i<max(aa,bb)){
arr[4][i]='#';
}else{
arr[4][i]='.';
}
}
if(aa==bb||abs(aa-bb)==1)arr[4][aa]='#';
cout<<"Yes\n";
for(int i=1;i<=7;i++){
for(int j=1;j<=n;j++){
cout<<arr[i][j];
}
cout<<'\n';
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll T=1;
cin >> T;
while(T--){
solve();
}
}
/*
7
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.####...####..#.......#####
.####...####..#.......#####
4
####
####
4
####
....
4
####
..#.
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 11704kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #... #... .#.. #..# .##. Yes ##.#. ..#.# .#... .#... .#... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... .#......................... .#......................... .#......................... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 9ms
memory: 9736kb
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: 10ms
memory: 9800kb
input:
10000 41 #######.#######.######################### ################.###.#######.############ 6 ..#..# #..##. 6 #.#... #...#. 6 .#.##. ....## 6 ...#.# ##..#. 33 #####.########################### ###########.##################### 6 .##.## .##.#. 5 ..##. ####. 17 #.###.##########. ####.##.#####.##. 5 ....
output:
Yes #######.#######.######################### .......#.......#......................... ......#.................................. .......########.......................... ...............#......................... ................#...#.......#............ ################.###.#######.############ Ye...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 9ms
memory: 9740kb
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: 10ms
memory: 10032kb
input:
10000 5 ...#. ##### 6 ###... ##..#. 9 .#.###### #.#..#### 49 ######.########################################## ########.#############.########################## 41 ###########.#######.##################### ##############.########################## 6 ###..# ###.## 49 #################################...
output:
No Yes ###... ...### ..#... ..#... .#.... ..##.# ##..#. Yes .#.###### #.#...... .#....... .#....... #........ .#.##.... #.#..#### Yes ######.########################################## ......#.......................................... .....#........................................... ......#............
result:
ok Correct.
Test #6:
score: 0
Accepted
time: 12ms
memory: 10120kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 7ms
memory: 10080kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.