# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999966 | Dipa | Tracks in the Snow (BOI13_tracks) | C++14 | 2102 ms | 97244 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>
#define INF_INT 2147483647
#define what_is(x) cerr << #x << " is " << x << endl;
#define all(v) v.begin(), v.end()
typedef long long ll;
using namespace std;
void solve() {
int H, W; cin >> H >> W;
string grid[H];
for (auto &el: grid) cin >> el;
vector<vector<int>> dist(H, vector<int>(W, 1e9));
deque<pair<int, int>> dq;
dq.push_back({0, 0});
dist[0][0] = 0;
while (!dq.empty()) {
pair<int, int> current = dq.front();
dq.pop_front();
// go down
if (current.first + 1 < H && (grid[current.first + 1][current.second] != '.')) {
if (grid[current.first + 1][current.second] != grid[current.first][current.second]) {
if (dist[current.first + 1][current.second] > dist[current.first][current.second] + 1) {
dist[current.first + 1][current.second] = dist[current.first][current.second] + 1;
dq.push_back({current.first + 1, current.second});
}
} else {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |