Submission #1291175

#TimeUsernameProblemLanguageResultExecution timeMemory
1291175kustov_vadim_533Towns (IOI15_towns)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <array>
#include <map>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <chrono>

using namespace std;

typedef long long ll;
typedef long double ld;

mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());

int hubDistance(int N, int sub) {
	int v = 0;
	int ds = 0, s = 0;
	for (int u = 0; u < N; ++u) {
		int du = getDistance(v, u);
		if (du > ds) {
			ds = du;
			s = u;
		}
	}

	vector<int> d;
	for (int u = 0; u < N; ++u) {
		d.push_back(getDistance(s, u));
	}

	sort(d.begin(), d.end());

	int mx = 0;
	for (int x : d) {
		if (x * 2 < d.back()) {
			mx = max(mx, x);
		}
	}
	return mx;
}

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:30:26: error: 'getDistance' was not declared in this scope; did you mean 'hubDistance'?
   30 |                 int du = getDistance(v, u);
      |                          ^~~~~~~~~~~
      |                          hubDistance
towns.cpp:39:29: error: 'getDistance' was not declared in this scope; did you mean 'hubDistance'?
   39 |                 d.push_back(getDistance(s, u));
      |                             ^~~~~~~~~~~
      |                             hubDistance