Submission #867718

# Submission time Handle Problem Language Result Execution time Memory
867718 2023-10-29T10:08:28 Z BoopyTheNoob Tracks in the Snow (BOI13_tracks) C++14
2.1875 / 100
64 ms 80728 KB
#include <iostream>
#include <vector>
#include <deque>
using namespace std;

int main (void) {
    iostream::sync_with_stdio(false);
	cin.tie(0);
    int dx[4] = {0, 0, 1, -1};
    int dy[4] = {1, -1, 0, 0};
    int N, M;
    cin >> N >> M;
    string grid[4000];
    for (int i = 0; i < N; i++)
        cin >> grid[i];
    int dist[4000][4000];
    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] == 0 || 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;
    }*/
    cout << ans << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 63320 KB Output isn't correct
2 Incorrect 29 ms 63320 KB Output isn't correct
3 Incorrect 29 ms 62980 KB Output isn't correct
4 Incorrect 29 ms 63124 KB Output isn't correct
5 Incorrect 29 ms 63064 KB Output isn't correct
6 Incorrect 29 ms 63056 KB Output isn't correct
7 Incorrect 29 ms 63068 KB Output isn't correct
8 Incorrect 29 ms 63068 KB Output isn't correct
9 Incorrect 29 ms 63068 KB Output isn't correct
10 Incorrect 31 ms 63200 KB Output isn't correct
11 Incorrect 30 ms 63136 KB Output isn't correct
12 Incorrect 29 ms 63060 KB Output isn't correct
13 Incorrect 29 ms 63056 KB Output isn't correct
14 Incorrect 29 ms 63132 KB Output isn't correct
15 Incorrect 30 ms 63316 KB Output isn't correct
16 Incorrect 30 ms 63320 KB Output isn't correct
17 Incorrect 29 ms 63316 KB Output isn't correct
18 Incorrect 29 ms 63324 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 63056 KB Output isn't correct
2 Incorrect 31 ms 64604 KB Output isn't correct
3 Incorrect 58 ms 80692 KB Output isn't correct
4 Incorrect 35 ms 66908 KB Output isn't correct
5 Incorrect 43 ms 72808 KB Output isn't correct
6 Incorrect 57 ms 80724 KB Output isn't correct
7 Incorrect 29 ms 63060 KB Output isn't correct
8 Incorrect 29 ms 63068 KB Output isn't correct
9 Incorrect 29 ms 63064 KB Output isn't correct
10 Incorrect 29 ms 63056 KB Output isn't correct
11 Incorrect 30 ms 63060 KB Output isn't correct
12 Incorrect 29 ms 63068 KB Output isn't correct
13 Incorrect 31 ms 64604 KB Output isn't correct
14 Incorrect 30 ms 64084 KB Output isn't correct
15 Incorrect 30 ms 64092 KB Output isn't correct
16 Incorrect 29 ms 63836 KB Output isn't correct
17 Incorrect 35 ms 67300 KB Output isn't correct
18 Incorrect 36 ms 67156 KB Output isn't correct
19 Incorrect 41 ms 67120 KB Output isn't correct
20 Incorrect 35 ms 66732 KB Output isn't correct
21 Incorrect 44 ms 73044 KB Output isn't correct
22 Incorrect 43 ms 72668 KB Output isn't correct
23 Incorrect 42 ms 71508 KB Output isn't correct
24 Incorrect 43 ms 72788 KB Output isn't correct
25 Incorrect 61 ms 80724 KB Output isn't correct
26 Correct 50 ms 76408 KB Output is correct
27 Incorrect 57 ms 80724 KB Output isn't correct
28 Incorrect 57 ms 80720 KB Output isn't correct
29 Incorrect 59 ms 80716 KB Output isn't correct
30 Incorrect 64 ms 80468 KB Output isn't correct
31 Incorrect 47 ms 74064 KB Output isn't correct
32 Incorrect 58 ms 80728 KB Output isn't correct