# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
542377 | Tam_theguide | Tracks in the Snow (BOI13_tracks) | C++14 | 1597 ms | 165212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, m;
const int dx[4]={0, 0, 1, -1};
const int dy[4]={1, -1, 0, 0};
char a[4005][4005];
bool visited[4005][4005];
int d[4005][4005];
int ans=1;
using P=pair<pair<int, int>, int>;
deque<P>dq;
bool check(int i, int j){
if (a[i][j]!='.' && 1<=i && i<=n && 1<=j && j<=m) return true;
else return false;
}
void bfs(){
dq.push_back({{1, 1}, 0});
d[1][1]=1;//vi ton 1 con vat;
while (!dq.empty()){
int distance=dq.front().second;
int u=dq.front().first.first;
int v=dq.front().first.second;
dq.pop_front();
if (visited[u][v]) continue;
visited[u][v]=true;
ans=max(ans, distance);
for (int t=0; t<4; t++){
int ii=u+dx[t];
int jj=v+dy[t];
if (check(ii, jj)==false || visited[ii][jj]) continue;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |