# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1026892 | Zicrus | Sky Walking (IOI19_walk) | C++17 | 4057 ms | 66260 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "walk.h"
using namespace std;
typedef long long ll;
ll min_distance(vector<int> x, vector<int> h, vector<int> l, vector<int> r, vector<int> y, int s, int t) {
int N = x.size(), M = y.size();
vector<pair<int, int>> pos;
vector<vector<int>> adj;
for (int j = 0; j < M; j++) {
vector<int> buildings;
for (int i = l[j]; i <= r[j]; i++) {
if (y[j] <= h[i]) {
buildings.push_back(x[i]);
}
}
int g = adj.size();
for (auto &e : buildings) {
vector<int> a;
int id = g - 1;
for (auto &c : buildings) {
id++;
if (e == c) continue;
a.push_back(id);
}
adj.push_back(a);
pos.push_back({e, y[j]});
}
}
adj.push_back({});
adj.push_back({});
pos.push_back({x[s], 0});
pos.push_back({x[t], 0});
vector<bool> vst(pos.size());
vector<ll> dist(pos.size(), 1ll << 62);
priority_queue<pair<int, int>> q;
dist[pos.size()-2] = 0;
q.push({0, pos.size()-2});
while (!q.empty()) {
int node = q.top().second; q.pop();
if (vst[node]) continue;
vst[node] = true;
vector<int> ac = adj[node];
for (int i = 0; i < pos.size(); i++) {
if (i == node) continue;
if (pos[i].first == pos[node].first) ac.push_back(i);
}
for (auto &e : ac) {
dist[e] = min(dist[e], dist[node] + abs(pos[node].first - pos[e].first) + abs(pos[node].second - pos[e].second));
q.push({-dist[e], e});
}
}
return dist.back() == (1ll << 62) ? -1 : dist.back();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |