Submission #83786

# Submission time Handle Problem Language Result Execution time Memory
83786 2018-11-10T15:14:34 Z teomrn Tracks in the Snow (BOI13_tracks) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

char mat[4010][4010];
vector <pair <int, int>> de_add, added, dir = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
bool viz[4010][4010];
int n, m;
char c;

void dfs(int a, int b)
{
    if (mat[a][b] != c || viz[a][b])
        return;
    viz[a][b] = 1;
    de_add.push_back({ a, b });
    for (auto i : dir)
        dfs(a + i.first, b + i.second);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
        cin >> (mat[i] + 1);

    int ans = 0;
    char c = mat[1][1];

    if (c == '.')
        return cout << 0, 0;

    dfs(1, 1);

    while (!de_add.empty()) {
        swap(de_add, added);
        de_add.clear();
        ans++;
        c = (act == 'F' ? 'R' : 'F');
        for (auto i : added)
            for (auto j : dir)
                dfs(i.first + j.first, i.second + j.second);
    }

    cout << ans << '\n';

    return 0;
}

Compilation message

tracks.cpp: In function 'int main()':
tracks.cpp:41:14: error: 'act' was not declared in this scope
         c = (act == 'F' ? 'R' : 'F');
              ^~~