Submission #302657

# Submission time Handle Problem Language Result Execution time Memory
302657 2020-09-19T02:36:31 Z shrek12357 Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include "travel.h"
using namespace std;

const long long INF = 1e10;
#define MAXN 15

bool ex[MAXN];
vector<pair<int, int>> adjList[MAXN];
int n, m, k;
long long dp[MAXN];

void dfs(int src, int par) {
	int cur = adjList[src].size();
	if (src != 0) {
		cur--;
	}
	if (ex[src]) {
		dp[src] = 0;
		return;
	}
	if (cur < 2) {
		return;
	}
	long long t1 = 5*INF, t2 = 5*INF;
	for (auto i : adjList[src]) {
		if (i.first == par) {
			continue;
		}
		dfs(i.first, src);
		if (dp[i.first] + i.second < t1) {
			t2 = t1;
			t1 = dp[i.first] + i.second;
		}
		else if (dp[i.first] + i.second < t2) {
			t2 = dp[i.first] + i.second;
		}
	}
	dp[src] = t2;
}

void travel_plan(int N, int M, int r[][2], int l[], int K, int p[]) {
	n = N; m = M; k = K;
	for (int i = 0; i < k; i++) {
		ex[p[i]] = true;
	}
	for (int i = 0; i < m; i++) {
		adjList[r[i][0]].push_back({ r[i][1], l[i] });
		adjList[r[i][1]].push_back({ r[i][0], l[i] });
	}
	for (int i = 0; i < n; i++) {
		dp[i] = INF;
	}
	dfs(0, 0);
	cout << dp[0] << endl;
}

Compilation message

crocodile.cpp:11:10: fatal error: travel.h: No such file or directory
   11 | #include "travel.h"
      |          ^~~~~~~~~~
compilation terminated.