From a6ccb6431bd746b264b93fda7efd5bf8afa50795 Mon Sep 17 00:00:00 2001 From: unlockable Date: Mon, 25 Aug 2025 12:20:17 +0800 Subject: [PATCH] =?UTF-8?q?2025=E8=80=83=E7=A0=94b=20all=20ac?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- thu2025kaoyan_b.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/thu2025kaoyan_b.cpp b/thu2025kaoyan_b.cpp index 4a8aebb..ad2dd27 100644 --- a/thu2025kaoyan_b.cpp +++ b/thu2025kaoyan_b.cpp @@ -53,16 +53,19 @@ int end_row, end_col; int map[MAXN][MAXN] = {0}; // 0 = wall // 1 = ground +// 2 = glass bool valid_pos(int row, int col, posture pos) { if (row >= n || col >= m || row < 0 || col < 0) { return false; } if (pos == pos_s) { - return map[row][col] > 0; + return map[row][col] == 1; } else if (pos == pos_h) { + if (col + 1 >= m) return false; return map[row][col] > 0 && map[row][col + 1] > 0; } else if (pos == pos_v) { + if (row + 1 >= n) return false; return map[row][col] > 0 && map[row + 1][col] > 0; } else { // should not be here @@ -287,8 +290,10 @@ int main() { for (int j = 0; j < m; ++j) { if (linebuf[j] == '#') { map[i][j] = 0; - } else if (linebuf[j] == '.' || linebuf[j] == 'E') { + } else if (linebuf[j] == '.') { map[i][j] = 1; + } else if (linebuf[j] == 'E') { + map[i][j] = 2; } else if (linebuf[j] == 'X') { map[i][j] = 1; if (found_start == false) {