用户输出
#.#
...
...
#.#
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#116944 | #1467. [L1-5] 为世界之光 | Wrong Answer | 60 | 8422 ms | 5744 K | C++ 17 / 2.1 K | Sakura丶Charon | 2025-04-19 14:22:18 |
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define debug(...)
#else
#include <debug.hpp>
#endif
#define int long long
#define x first
#define y second
using namespace std;
const int mod = 998244353; // 1e9 + 7;
void pre() {}
void solve() {
int n, m;
cin >> n >> m;
vector<string> g(n);
for (string &s : g) cin >> s;
vector<pair<int, int>> a;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
if (g[i][j] == '*')
a.push_back({ i, j });
set<pair<int, int>> S;
int dx[] = { -1, 0, 1, 0 };
int dy[] = { 0, 1, 0, -1 };
auto dfs = [&](auto &&dfs, int x, int y) -> void {
for (int i = 0; i < 4; i++) {
int nx = x + dx[i];
int ny = y + dy[i];
if (nx < 0 || nx >= n || ny < 0 || ny >= m)
continue;
if (S.count({ nx, ny }))
continue;
S.insert({ nx, ny });
bool flag = true;
for (auto &&[tx, ty] : a) {
int ntx = tx + dx[i];
int nty = ty + dy[i];
if (ntx < 0 || ntx >= n || nty < 0 || nty >= m) {
flag = false;
break;
}
}
if (flag) {
for (auto &&[tx, ty] : a) {
tx += dx[i];
ty += dy[i];
g[tx][ty] = '*';
dfs(dfs, nx, ny);
tx -= dx[i];
ty -= dy[i];
}
}
}
};
S.insert({ a[0].x, a[0].y });
dfs(dfs, a[0].x, a[0].y);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (g[i][j] == '#')
cout << '#';
else
cout << '.';
}
cout << '\n';
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int _ = 1;
// cin >> _;
pre();
while (_--) solve();
return 0;
}
用户输出
#.#
...
...
#.#
系统信息
Exited with return code 0
用户输出
##.##
#####
.###.
#####
##.##
系统信息
Exited with return code 0
15 15
*##*#*######***
##*##**##*###**
####*##****##*#
#*#**#*#*##**#*
##*****#**##**#
**#***#***#***
<146 bytes omitted>
.##.#.######...
##.##..##.###..
####.##....##.#
#.#..#.#.##..#.
##.....#..##..#
..#...#...#...#
.##.
<140 bytes omitted>
用户输出
.##.#.######...
##.##..##.###..
####.##....##.#
#.#..#.#.##..#.
##.....#..##..#
..#...#...#...#
.##.#....#...##
#..##..#.#.##..
<112 bytes omitted>
系统信息
Exited with return code 0
100 100
############################################################################################
<10008 bytes omitted>
#..................................................................................................#
<10000 bytes omitted>
用户输出
....................................................................................................
...........................
<9972 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0