QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#751060 | #9621. 连方 | CHROMIUM00 | AC ✓ | 7ms | 4340kb | C++17 | 9.4kb | 2024-11-15 16:54:46 | 2024-11-15 16:54:46 |
Judging History
answer
/* === INCLUDES === ---------------------------------------------------------- */
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
/* === UTILITY === ----------------------------------------------------------- */
#ifdef _LOCAL_
#define SHOW(x) \
{ \
cerr << "[" #x "]: " << (x) << "\n"; \
}
#define SHOW_EACH(x) \
{ \
bool _head = true; \
cerr << "[" #x "]: {"; \
for (auto _iter : (x)) { \
if (_head) { \
_head = false; \
} else { \
cerr << ", "; \
} \
cerr << _iter; \
} \
cerr << "}" << "\n"; \
}
#define SHOW_RANGE(x, l, r) \
{ \
bool _head = true; \
cerr << "[" #x "]: {"; \
for (auto _iter = (l); _iter <= (r); ++_iter) { \
if (_head) { \
_head = false; \
} else { \
cerr << ", "; \
} \
cerr << (x)[_iter]; \
} \
cerr << "}" << "\n"; \
}
#else
#define SHOW(x)
#define SHOW_EACH(x)
#define SHOW_RANGE(x, l, r)
#endif // _LOCAL_
/* === MACROS === -------------------------------------------------------------*/
#define FASTIO \
ios::sync_with_stdio(false); \
cin.tie(0), cout.tie(0)
#define MULTICASE \
int _T; \
cin >> _T; \
while (_T--)
#define LL long long
#define IMAX 2147483647
#define LLMAX 9223372036854775807LL
#define endl "\n"
////////////////////////////////// ┏━━━━━━━━━┓ //////////////////////////////////
////////////////////////////////// ┣━╸ ┏━━━╸ ┃ //////////////////////////////////
////////////////////////////////// ┃ ┏━┻━━━━━┫ //////////////////////////////////
////////////////////////////////// ┃ ┣━━━━━╸ ┃ //////////////////////////////////
////////////////////////////////// ┃ ┃ ╺━━━━━┫ //////////////////////////////////
////////////////////////////////// ┣━┻━━━━━┳━┫ //////////////////////////////////
////////////////////////////////// ┃ ╻ ╻ ╺━┫ ┃ //////////////////////////////////
////////////////////////////////// ┣━╋━╋━┳━┫ ┃ //////////////////////////////////
////////////////////////////////// ┃ ╹ ╹ ┃ ┃ ┃ //////////////////////////////////
////////////////////////////////// ┃ ╻ ╻ ┃ ┃ ┃ //////////////////////////////////
////////////////////////////////// ┣━┻━┻━┻━┻━┫ //////////////////////////////////
////////////////////////////////// ┣━╸ ╺┳╸ ╺━┫ //////////////////////////////////
////////////////////////////////// ┣━╸ ╺┻╸ ╺━┫ //////////////////////////////////
////////////////////////////////// ┣━┳━┳━┳━┳━┫ //////////////////////////////////
////////////////////////////////// ┣━┛ ┗━┛ ┗━┫ //////////////////////////////////
////////////////////////////////// ┣━━━━━━━━━┫ //////////////////////////////////
////////////////////////////////// ┣╸ ╺━━━╸ ╺┫ //////////////////////////////////
////////////////////////////////// ┣━━━┓ ┏━━━┫ //////////////////////////////////
////////////////////////////////// ┃ ╻ ╹ ╹ ╻ ┃ //////////////////////////////////
////////////////////////////////// ┣━┻━━━━━┻━┫ //////////////////////////////////
////////////////////////////////// ┣━━━╸ ┏━━━┫ //////////////////////////////////
////////////////////////////////// ┃ ╺━━━┛ ╻ ┃ //////////////////////////////////
////////////////////////////////// ┗━━━━━━━┻━┛ //////////////////////////////////
int n;
string a, b;
void ChromicChlorideHexahydrate()
{
cin >> n;
cin >> a >> b;
vector<string> mid(7, string(n, '.'));
bool top = false, bot = false;
for (int i = 0; i < n; i++) {
if (a[i] == '.') {
mid[2][i] = '#';
top = true;
}
if (b[i] == '.') {
mid[6][i] = '#';
bot = true;
}
}
if (!top && !bot) {
cout << "Yes" << endl;
for (int i = 1; i <= 7; i++) {
cout << a << endl;
}
return;
}
if (!(top && bot)) {
cout << "No" << endl;
return;
}
int tp = -1, bt = -1;
for (int i = 0; i < n; i++) {
if (mid[2][i] == '.' && ((0 <= i - 1 && mid[2][i - 1] == '#') || (i + 1 < n && mid[2][i + 1] == '#'))) {
mid[3][i] = '#';
tp = i;
break;
}
}
for (int i = 0; i < n; i++) {
if (mid[6][i] == '.' && ((0 <= i - 1 && mid[6][i - 1] == '#') || (i + 1 < n && mid[6][i + 1] == '#'))) {
mid[5][i] = '#';
bt = i;
break;
}
}
if (tp > bt) {
swap(tp, bt);
}
if (tp == bt) {
if (tp + 1 < n) {
mid[4][tp + 1] = '#';
} else if (0 <= tp - 1) {
mid[4][tp - 1] = '#';
}
} else if (tp + 1 == bt) {
mid[4][tp] = '#';
} else {
for (int i = tp + 1; i <= bt - 1; i++) {
mid[4][i] = '#';
}
}
cout << "Yes" << endl;
cout << a << endl;
for (int i = 2; i <= 6; i++) {
cout << mid[i] << endl;
}
cout << b << endl;
}
signed main()
{
FASTIO;
MULTICASE ChromicChlorideHexahydrate();
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3492kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #... #... .#.. #..# .##. Yes ##.#. ..#.# .#... ..#.. .#... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... .#......................... ..#........................ .#......................... #....###....##.#######..... .####...####..#.......##### Yes ########...
result:
ok Correct.
Test #2:
score: 0
Accepted
time: 7ms
memory: 3860kb
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: 7ms
memory: 3564kb
input:
10000 41 #######.#######.######################### ################.###.#######.############ 6 ..#..# #..##. 6 #.#... #...#. 6 .#.##. ....## 6 ...#.# ##..#. 33 #####.########################### ###########.##################### 6 .##.## .##.#. 5 ..##. ####. 17 #.###.##########. ####.##.#####.##. 5 ....
output:
Yes #######.#######.######################### .......#.......#......................... ......#.................................. .......########.......................... ...............#......................... ................#...#.......#............ ################.###.#######.############ Ye...
result:
ok Correct.
Test #4:
score: 0
Accepted
time: 3ms
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: 3ms
memory: 3600kb
input:
10000 5 ...#. ##### 6 ###... ##..#. 9 .#.###### #.#..#### 49 ######.########################################## ########.#############.########################## 41 ###########.#######.##################### ##############.########################## 6 ###..# ###.## 49 #################################...
output:
No Yes ###... ...### ..#... .#.... .#.... ..##.# ##..#. Yes .#.###### #.#...... .#....... #........ #........ .#.##.... #.#..#### Yes ######.########################################## ......#.......................................... .....#........................................... ......#............
result:
ok Correct.
Test #6:
score: 0
Accepted
time: 4ms
memory: 4340kb
input:
2 100000 ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.#...
output:
Yes ###.#...#..####...#####..####.#.######.##.##..#..#..####...###.#..##.#.##.####.#.#.###...#.##...####.#.#.####...####.#..##.##.#.#.....####..####..#...#..#.##..#.##.#.....#..#.#.###.#....####...####..##.#.#####..####.##.#.###.#.#....#.##.##...#.######.#..##..##...#.....#....#.####...#...##.##.#.....
result:
ok Correct.
Test #7:
score: 0
Accepted
time: 4ms
memory: 4252kb
input:
2 100000 ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##...
output:
Yes ##.####.#..#..#.##..#.#..###..##..#####.....#..##.##.#...#.###..##..#...##...####..#...##...##.......#.#..##.##..###.#.###.##.#########..#...###.####.##...#..#.....#####.....#.####.#####..#.#....#..###.#.##..#..#.##.......#.###.##...####.....######..#.##....#.#.###.#.###.#..#.....####....##........
result:
ok Correct.