# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
867723 | 2023-10-29T10:19:04 Z | BoopyTheNoob | Tracks in the Snow (BOI13_tracks) | C++14 | 42 ms | 1372 KB |
#include <iostream> #include <vector> #include <deque> using namespace std; int main (void) { int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; int N, M; scanf("%d %d", &N, &M); vector<string> grid(N); for (int i = 0; i < N; i++) scanf("%s", &grid[i]); vector<vector<int>> dist(N, vector<int>(M, 1e9)); deque<vector<int>> bfs; bfs.push_back({0, 0, 1}); int ans = 0; while (!bfs.empty()) { int x = bfs.front()[0], y = bfs.front()[1], d = bfs.front()[2]; bfs.pop_front(); dist[x][y] = d; ans = max(ans, d); for (int i = 0; i < 4; i++) { int nx = x + dx[i], ny = y + dy[i]; if (nx < 0 || nx >= N || ny < 0 || ny >= M) continue; if (dist[nx][ny] < 1e9 || grid[nx][ny] == '.') continue; vector<int> next = {nx, ny, d}; if (grid[x][y] != grid[nx][ny]) { next[2]++; bfs.push_back(next); } else bfs.push_front(next); } } /*for (auto x: dist) { for (auto y: x) { cout << y << " "; } cout << endl; }*/ printf("%d", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 348 KB | Execution killed with signal 6 |
2 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |
3 | Runtime error | 0 ms | 348 KB | Execution killed with signal 6 |
4 | Runtime error | 1 ms | 604 KB | Execution killed with signal 6 |
5 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
6 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |
7 | Runtime error | 0 ms | 348 KB | Execution killed with signal 6 |
8 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
9 | Runtime error | 0 ms | 348 KB | Execution killed with signal 6 |
10 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
11 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
12 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
13 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
14 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
15 | Runtime error | 1 ms | 856 KB | Execution killed with signal 6 |
16 | Runtime error | 2 ms | 604 KB | Execution killed with signal 6 |
17 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
18 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 1372 KB | Execution killed with signal 11 |
2 | Runtime error | 4 ms | 604 KB | Execution killed with signal 6 |
3 | Runtime error | 33 ms | 800 KB | Execution killed with signal 6 |
4 | Runtime error | 9 ms | 604 KB | Execution killed with signal 6 |
5 | Runtime error | 19 ms | 604 KB | Execution killed with signal 6 |
6 | Runtime error | 33 ms | 804 KB | Execution killed with signal 6 |
7 | Runtime error | 1 ms | 1372 KB | Execution killed with signal 11 |
8 | Runtime error | 2 ms | 1372 KB | Execution killed with signal 11 |
9 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
10 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
11 | Runtime error | 2 ms | 1372 KB | Execution killed with signal 11 |
12 | Runtime error | 1 ms | 348 KB | Execution killed with signal 6 |
13 | Runtime error | 4 ms | 604 KB | Execution killed with signal 6 |
14 | Runtime error | 2 ms | 604 KB | Execution killed with signal 6 |
15 | Runtime error | 4 ms | 604 KB | Execution killed with signal 6 |
16 | Runtime error | 2 ms | 348 KB | Execution killed with signal 6 |
17 | Runtime error | 9 ms | 496 KB | Execution killed with signal 6 |
18 | Runtime error | 11 ms | 604 KB | Execution killed with signal 6 |
19 | Runtime error | 8 ms | 492 KB | Execution killed with signal 6 |
20 | Runtime error | 8 ms | 488 KB | Execution killed with signal 6 |
21 | Runtime error | 20 ms | 600 KB | Execution killed with signal 6 |
22 | Runtime error | 19 ms | 524 KB | Execution killed with signal 6 |
23 | Runtime error | 17 ms | 604 KB | Execution killed with signal 6 |
24 | Runtime error | 23 ms | 604 KB | Execution killed with signal 6 |
25 | Runtime error | 33 ms | 592 KB | Execution killed with signal 6 |
26 | Runtime error | 30 ms | 604 KB | Execution killed with signal 6 |
27 | Runtime error | 40 ms | 804 KB | Execution killed with signal 6 |
28 | Runtime error | 34 ms | 604 KB | Execution killed with signal 6 |
29 | Runtime error | 33 ms | 604 KB | Execution killed with signal 6 |
30 | Runtime error | 42 ms | 856 KB | Execution killed with signal 6 |
31 | Runtime error | 22 ms | 608 KB | Execution killed with signal 6 |
32 | Runtime error | 34 ms | 796 KB | Execution killed with signal 6 |