WAC???

P11228 [CSP-J 2024] 地图探险

NJYNsss @ 2024-11-04 23:17:53

为啥我这道题比赛WA,洛谷就AC了


by Master_Q @ 2024-11-04 23:27:16

申诉吧


by tyr_04 @ 2024-11-05 00:28:27

@NJYNsss 代码呢?


by lpsz2024wcs @ 2024-11-05 00:40:27

看 CCF 的数据吧


by NJYNsss @ 2024-11-06 22:09:39

@tyr_04

#include <iostream>

int T, n, m, k, x, y, d, c = 0;
long long b[9999][9999] = {0};
char a[9999][9999];
void so(int sx, int sy, int sd, int sk) {
    // std::cout << sx << ' ' << sy << ' ' << sd << ' ' << sk << std::endl;
    if (sk < 0) return ;
    b[sx][sy]++;
    if (sd == 0) {
        if (!(sy + 1 > m || a[sx][sy + 1] == 'x')) so(sx, sy + 1, sd, sk - 1);
        else so(sx, sy, (sd + 1) % 4, sk - 1);
    }
    else if (sd == 1) {
        if (!(sx + 1 > n || a[sx + 1][sy] == 'x')) so(sx + 1, sy, sd, sk - 1);
        else so(sx, sy, (sd + 1) % 4, sk - 1);
    }
    else if (sd == 2) {
        if (!(sy - 1 < 1 || a[sx][sy - 1] == 'x')) so(sx, sy - 1, sd, sk - 1);
        else so(sx, sy, (sd + 1) % 4, sk - 1);
    }
    else if (sd == 3) {
        if (!(sx - 1 < 1 || a[sx - 1][sy] == 'x')) so(sx - 1, sy, sd, sk - 1);
        else so(sx, sy, (sd + 1) % 4, sk - 1);
    }
}
int main() {
    freopen("explore.in", "r", stdin);
    freopen("explore.out", "w", stdout);
    std::cin >> T;
    while (T --> 0) {
        for (int i = 0; i <= n; i++) for (int j = 0; j <= m; j++) b[i][j] = 0;
        n = 0, m = 0, k = 0, x = 0, y = 0, d = 0, c = 0;
        std::cin >> n >> m >> k;
        std::cin >> x >> y >> d;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                std::cin >> a[i][j];
            }
        }
        so(x, y, d, k);
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (b[i][j] > 0) c++;
                // std::cout << "c " << i << ' ' << j << ' ' << b[i][j] << ' ' << c << std::endl;
            }
        }
        std::cout << c << std::endl;
        // std::cout << std::endl;
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}

by tyr_04 @ 2024-11-06 22:30:34

@NJYNsss 感觉没有任何问题,申诉一下?(注意要到NOI Linux下编译)


by NJYNsss @ 2024-11-07 21:13:01

@tyr_04 已经交钱了


by tyr_04 @ 2024-11-07 21:51:03

@NJYNsss 今天都截止了。。。


by NJYNsss @ 2024-11-07 22:10:14

@tyr_04 昨天交的


|