编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#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;
}
子任务 #1
Wrong Answer
得分:60
测试点 #1
Accepted
得分:100
用时:2 ms
内存:244 KiB

输入文件(a2.in

4 3
#*#
***
#*#
###

答案文件(a2.ans

#.#
...
...
#.#

用户输出

#.#
...
...
#.#

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:3 ms
内存:256 KiB

输入文件(a3.in

5 5
##*##
#####
*###*
#####
##*##

答案文件(a3.ans

##.##
#####
.###.
#####
##.##

用户输出

##.##
#####
.###.
#####
##.##

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:3 ms
内存:232 KiB

输入文件(a4.in

15 15
*##*#*######***
##*##**##*###**
####*##****##*#
#*#**#*#*##**#*
##*****#**##**#
**#***#***#***
<146 bytes omitted>

答案文件(a4.ans

.##.#.######...
##.##..##.###..
####.##....##.#
#.#..#.#.##..#.
##.....#..##..#
..#...#...#...#
.##.
<140 bytes omitted>

用户输出

.##.#.######...
##.##..##.###..
####.##....##.#
#.#..#.#.##..#.
##.....#..##..#
..#...#...#...#
.##.#....#...##
#..##..#.#.##..

<112 bytes omitted>

系统信息

Exited with return code 0
测试点 #4
Wrong Answer
得分:0
用时:361 ms
内存:1720 KiB

输入文件(a5.in

100 100
############################################################################################
<10008 bytes omitted>

答案文件(a5.ans

#..................................................................................................#
<10000 bytes omitted>

用户输出

....................................................................................................
...........................
<9972 bytes omitted>

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #5
Time Limit Exceeded
得分:0
用时:8053 ms
内存:5744 KiB

输入文件(a6.in

200 200
############################################################################################
<40108 bytes omitted>

答案文件(a6.ans

#######.............................................................................................
<40100 bytes omitted>