# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101427 | dwsc | Tracks in the Snow (BOI13_tracks) | C++14 | 1213 ms | 134948 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;
typedef pair<int,int> ii;
typedef pair<int,ii> i3;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int h,w;
cin >> h >> w;
char grid[h][w];
int visit[h][w];
for (int i = 0; i < h; i++){
for (int j = 0; j < w; j++) {
cin >> grid[i][j];
visit[i][j] = 0;
}
}
deque<i3> dq;
int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
int ans = 1;
visit[0][0] = 1;
dq.push_front(i3(1,ii(0,0)));
while (!dq.empty()){
i3 f = dq.front();
dq.pop_front();
int num = f.first,x = f.second.first,y = f.second.second;
for (int i = 0; i < 4; i++){
int nx = x+dx[i],ny = y+dy[i];
if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
if (grid[nx][ny] == '.') continue;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |