# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
854756 | cj03 | Tracks in the Snow (BOI13_tracks) | C++14 | 1640 ms | 1048576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int a[4005][4005];
vector<pair<pair<int,int>, int>> adj[4005][4005];
int d[4005][4005];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int h, w; cin >> h >> w;
memset(d, -1, sizeof(d));
for (int i = 1; i <= h; i++) {
for (int j = 1; j <= w; j++) {
char c; cin >> c;
if (c=='.') a[i][j]=1;
if (c=='R') a[i][j]=2;
if (c=='F') a[i][j] = 3;
}
}
for (int i = 1; i <= h; i++) {
for (int j = 1; j <= w; j++) {
int x = a[i][j]; if (x==1) continue;
if (i+1 <= h && a[i+1][j]!=1) adj[i][j].push_back({{i+1, j}, (x==5-a[i+1][j])});
if (i-1 >= 1 && a[i-1][j]!=1) adj[i][j].push_back({{i-1, j}, (x==5-a[i-1][j])});
if (j+1 <= w && a[i][j+1]!=1) adj[i][j].push_back({{i, j+1}, (x==5-a[i][j+1])});
if (j-1 >= 1 && a[i][j-1] != 1) adj[i][j].push_back({{i, j-1}, (x==5-a[i][j-1])});
}
}
d[h][w] = 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |