W#6的应该是在预处理将四周圈出一圈时 圈的值太小了

P1434 [SHOI2002] 滑雪

Cake_C @ 2019-10-10 10:21:35

错误做法:

int tmp = r*c+1;
F(i, 0, r + 1) {
    map[i][0] = tmp;
    map[i][c + 1] = tmp;
}
F(i, 0, c + 1) {
    map[0][i] = tmp;
    map[r + 1][i] = tmp;
}

正确做法:

int tmp = 2147483647;
F(i, 0, r + 1) {
    map[i][0] = tmp;
    map[i][c + 1] = tmp;
}
F(i, 0, c + 1) {
    map[0][i] = tmp;
    map[r + 1][i] = tmp;
}

by Cake_C @ 2019-10-10 10:22:16

从高到低搜索会有这种问题 从低到高就不会


by lygmh @ 2019-10-10 10:32:04

???所以说您想表达什么


|