Submission #990285

# Submission time Handle Problem Language Result Execution time Memory
990285 2024-05-30T06:09:11 Z starchan Towns (IOI15_towns) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "towns.h"
using namespace std;
#define in array<int, 2>
#define pb push_back
#define pob pop_back

int hubDistance(int n, int sub)
{
	in opt = {0, 0};
	for(int i = 1; i < n; i++)
		opt = max(opt, {getDistance(i, 0), i});
	int a = opt[1]; opt = {0, a};
	vector<int> d1(n), d2(n); d1[a] = 0;
	for(int i = 0; i < n; i++)
	{
		if(i == a) continue;
		opt = max(opt, {d1[i] = getDistance(i, a), i});
	}
	auto [D, b] = opt; d2[b] = 0;
	map<int, vector<int>> diam; diam[0].pb(a); diam[D].pb(b);
	for(int i = 0; i < n; i++)
	{
		if(i == a || i == b)
			continue;
		d2[i] = getDistance(i, b);
		diam[(d1[i]-d2[i]+D)/2].pb(i);
	}
	int R = INF;
	for(auto [X, v]: diam)
		R = min(R, max(X, D-X));
	vector<vector<int>> gd;
	for(auto [X, v]: diam)
	{
		if(max(X, D-X) == R)
			gd.pb(v);
	}
	return R;
}	

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:29:10: error: 'INF' was not declared in this scope
   29 |  int R = INF;
      |          ^~~
towns.cpp:8:28: warning: unused parameter 'sub' [-Wunused-parameter]
    8 | int hubDistance(int n, int sub)
      |                        ~~~~^~~