QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#759293 | #9621. 连方 | daidainiao | AC ✓ | 8ms | 4416kb | C++20 | 2.2kb | 2024-11-18 00:13:59 | 2024-11-18 00:14:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
void solve()
{
int n;
string a, b;
// scanf("%lld%s%s",&n,a,b);
cin >> n ;
//getchar();
cin>> a >> b;
string f(n, '.');
string ff(n,'#');
vector<string> s(8,f);
s[1] = a;
s[7] = b;
if(a==ff&&b==ff)
{
cout<<"Yes"<<endl;
for(int i=0;i<7;i++)
{
cout<<a<<endl;
}
return;
}
if(a==ff&&b!=ff)
{
cout<<"No"<<endl;
return;
}
if(a!=ff&&b==ff)
{
cout<<"No"<<endl;
return;
}
cout<<"Yes"<<endl;
for(int i=0;i<n;i++)
{
if(s[1][i]=='.') s[2][i]='#';
if(s[7][i]=='.') s[6][i]='#';
}
int l=-1;
int r=-1;
for(int i=0;i<n;i++)
{
if(s[2][i]=='.')
{
if(i==0)
{
if(s[2][i+1]=='#') l=i;
//if(s[6][i+1]=='#') r=i;
//continue;
}
if(i==n-1)
{
if(s[2][i-1]=='#') l=i;
//if(s[6][i-1]=='#') r=i;
//continue;
}
if(i!=0&&s[2][i-1]=='#'||s[2][i+1]=='#') l=i;
}
if(s[6][i]=='.')
{
if(i==0)
{
//if(s[2][i+1]=='#') l=i;
if(s[6][i+1]=='#') r=i;
//continue;
}
if(i==n-1)
{
//if(s[2][i-1]=='#') l=i;
if(s[6][i-1]=='#') r=i;
//continue;
}
if(i!=0&&s[6][i-1]=='#'||s[6][i+1]=='#') r=i;
}
}
s[3][l]='#';
s[5][r]='#';
if(l==r||l+1==r||r+1==l)
{
s[4][l]='#';
}
else
{
if(l>r)
{
int dd=l;
l=r;
r=dd;
}
for(int i=l+1;i<r;i++)
{
s[4][i]='#';
}
}
for(int i=1;i<=7;i++)
{
cout<<s[i]<<endl;
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
t=1;
cin>>t;
while(t--)
{
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3512kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. ...# ...# ..#. #..# .##. Yes ##.#. ..#.# ...#. ...#. ...#. #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... ......................#.... ......................#.... ......................#.... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 8ms
memory: 3536kb
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: 4ms
memory: 3824kb
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: 3904kb
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: 8ms
memory: 3892kb
input:
10000 5 ...#. ##### 6 ###... ##..#. 9 .#.###### #.#..#### 49 ######.########################################## ########.#############.########################## 41 ###########.#######.##################### ##############.########################## 6 ###..# ###.## 49 #################################...
output:
No Yes ###... ...### ..#... ...#.. ....#. ..##.# ##..#. Yes .#.###### #.#...... ...#..... ....#.... .....#... .#.##.... #.#..#### Yes ######.########################################## ......#.......................................... .......#......................................... ........########...
result:
ok Correct.
Test #6:
score: 0
Accepted
time: 0ms
memory: 4416kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 7ms
memory: 4316kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.