QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#736509 | #9621. 连方 | msiad | AC ✓ | 16ms | 4656kb | C++17 | 1.6kb | 2024-11-12 11:28:01 | 2024-11-12 11:28:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 998244353;
char a[10][N];
void solve() {
int n;
cin >> n;
for (int i = 1;i < 10;i++) {
for (int j = 0;j <= n;j++) {
a[i][j] = '.';
}
}
for (int i = 1;i <= n;i++)cin >> a[1][i];
for (int i = 1;i <= n;i++)cin >> a[7][i];
for (int i = 1;i <= n;i++) {
a[2][i] = (a[1][i] == '.') ? '#' : '.';
a[6][i] = (a[7][i] == '.') ? '#' : '.';
}
int l = -1, r = -1;
for (int i = 2;i <= n;i++) {
if (a[2][i] == '.' && a[2][i - 1] == '#')l = i;
if (a[6][i] == '.' && a[6][i - 1] == '#')r = i;
}
for (int i = 1;i < n;i++) {
if (a[2][i] == '.' && a[2][i + 1] == '#')l = i;
if (a[6][i] == '.' && a[6][i + 1] == '#')r = i;
}
//cout << l << " " << r << "\n";
if (l == -1 && r == -1) {
for (int i = 2;i <= 6;i++) {
for (int j = 1;j <= n;j++) {
a[i][j] = '#';
}
}
}
else if (l == -1 || r == -1) {
cout << "No\n";
return;
}
else {
a[3][l] = a[5][r] = '#';
for (int i = min(l, r) + 1;i <= max(l, r) - 1; i++) {
a[4][i] = '#';
}
if (abs(r - l) <= 1)a[4][l] = '#';
}
cout << "Yes\n";
for (int i = 1;i <= 7;i++) {
for (int j = 1;j <= n;j++) {
cout << a[i][j];
}
cout << "\n";
}
}
signed main() {
cin.tie(nullptr)->ios::sync_with_stdio(false);
int _ = 1;
cin >> _;
while (_--) {
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3760kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #... .#.. ..#. #..# .##. Yes ##.#. ..#.# ...#. ..#.. .#... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... ....................#...... ...............#####....... ..............#............ #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 15ms
memory: 3744kb
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: 16ms
memory: 3700kb
input:
10000 41 #######.#######.######################### ################.###.#######.############ 6 ..#..# #..##. 6 #.#... #...#. 6 .#.##. ....## 6 ...#.# ##..#. 33 #####.########################### ###########.##################### 6 .##.## .##.#. 5 ..##. ####. 17 #.###.##########. ####.##.#####.##. 5 ....
output:
Yes #######.#######.######################### .......#.......#......................... ..............#.......................... ...............############.............. ...........................#............. ................#...#.......#............ ################.###.#######.############ Ye...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 15ms
memory: 3696kb
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: 16ms
memory: 3712kb
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: 4656kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 12ms
memory: 4592kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.