# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
778554 | jasmin | Sky Walking (IOI19_walk) | C++17 | 4099 ms | 551336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "walk.h"
#include<bits/stdc++.h>
using namespace std;
const long long INF=1e18;
int distance(int i, int h, int j, int h2, vector<int>& x){
return abs(x[i]-x[j]) + abs(h-h2);
}
long long dijkstra(int n, map<int, map<int, vector<pair<int,int> > > >& adi, int a, int b, vector<int>& x){
map<int, map<int, long long> > dist; //plus 1
dist[a][0]=1;
map<int, map<int, bool> > vis;
priority_queue<pair<long long, pair<int,int> > > pq;
pq.push({-1, {a, 0}});
while(!pq.empty()){
auto [v, h] = pq.top().second;
pq.pop();
if(vis[v][h]) continue;
vis[v][h]=true;
for(auto [u, h2]: adi[v][h]){
if(dist[u][h2]==0 || dist[v][h]+distance(v, h, u, h2, x)<dist[u][h2]){
# | 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... |