답안 #826089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
826089 2023-08-15T10:19:23 Z caganyanmaz Sky Walking (IOI19_walk) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#define int int64_t
#define DEBUGGING

#ifdef DEBUGGING
#include "../debug.h"
#else
#define debug(x...) void(42)
#endif

constexpr static int MXN = 1e5 + 5;
constexpr static int INF = 1e17;
vector<array<int,2>> is[MXN];// Height, type
vector<bool> visited[MXN];
vector<int> min_dist[MXN];



long long min_distance(vector<int32_t> x, vector<int32_t> h, vector<int32_t> l, vector<int32_t> r, vector<int32_t> y, int32_t s, int32_t g)
{
	int n = x.size();
	int m = y.size();
	for (int i = 0; i < m; i++)
	{
		is[l[i]].pb({y[i], r[i]});
		is[r[i]].pb({y[i], l[i]});
	}
	is[s].pb({0, -1});
	is[g].pb({0, -1});
	for (int i = 0; i < x.size(); i++)
	{
		sort(is[i].begin(), is[i].end());
		min_dist[i] = vector<int> (is[i].size(), INF);
		visited[i] = vector<bool>(is[i].size(), false);
	}
	priority_queue<array<int, 3>> pq; // dist, tower, index
	min_dist[s][0] = 0;
	pq.push({0, s, 0});
	int res = 0;
	while (pq.size())
	{
		auto [dist, i, j] = pq.top();
		pq.pop();
		if (visited[i][j])
			continue;
		if (i == g && j == 0)
			break;
		visited[i][j] = true;
		int ni = is[i][j][1];
		if (ni != -1)
		{
			int nj = lower_bound(is[ni].begin(), is[ni].end(), array<int, 2>({is[i][j][0], i})) - is[ni].begin();
			if (min_dist[ni][nj] > min_dist[i][j] + abs(x[ni] - x[i]))
			{
				min_dist[ni][nj] = min_dist[i][j] +  abs(x[ni] - x[i]);
				pq.push({-min_dist[ni][nj], ni, nj});
			}
		}
		if (j > 0 && min_dist[i][j-1] > min_dist[i][j] + abs(is[i][j][0] - is[i][j-1][0]))
		{
			min_dist[i][j-1] = min_dist[i][j] + abs(is[i][j][0] - is[i][j-1][0]);
			pq.push({-min_dist[i][j-1], i, j-1});
		}
		if (j < is[i].size()-1 && min_dist[i][j+1] > min_dist[i][j] + abs(is[i][j][0] - is[i][j+1][0]))
		{
			min_dist[i][j+1] = min_dist[i][j] + abs(is[i][j][0] - is[i][j+1][0]);
			pq.push({-min_dist[i][j+1], i, j+1});
		}
	}
	if (min_dist[g][0] >= INF)
		return -1;
	return min_dist[g][0];
}

Compilation message

walk.cpp:8:10: fatal error: ../debug.h: No such file or directory
    8 | #include "../debug.h"
      |          ^~~~~~~~~~~~
compilation terminated.