# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
685681 | tcmmichaelb139 | Tracks in the Snow (BOI13_tracks) | C++17 | 1089 ms | 94036 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
const int MAXN = 4001;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int n, m;
char ar[MAXN][MAXN];
bool vis[MAXN][MAXN];
char cur;
queue<pair<int, int>> qcur;
queue<pair<int, int>> qnext;
void dfs(queue<pair<int, int>> q) {
while (!q.empty()) {
pair<int, int> v = q.front();
q.pop();
if (vis[v.first][v.second]) continue;
vis[v.first][v.second] = true;
for (int i = 0; i < 4; i++) {
pair<int, int> u = {v.first + dx[i], v.second + dy[i]};
if (u.first < 0 || u.second < 0 || u.first >= n || u.second >= m) continue;
if (ar[u.first][u.second] == '.') continue;
if (vis[u.first][u.second]) continue;
if (ar[u.first][u.second] == cur)
q.push(u);
else
qnext.push(u);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |