Submission #553683

#TimeUsernameProblemLanguageResultExecution timeMemory
553683keta_tsimakuridzeTowns (IOI15_towns)C++17
Compilation error
0 ms0 KiB
#include "towns.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 505;
ll d[2][N];
int hubDistance(int n, int sub) {
	int U = 0, V = 0;
	for(int i = 1; i < n; i++) {
		d[0][i] = solve(0, i); 
		if(d[0][i] >= d[0][U]) U = i;
	}
	for(int i = 0; i < n; i++) {
		if(U == i) continue;
		
		d[1][i] = solve(U, i);
		
		if(d[1][i] >= d[1][V]) V = i;
	}
	vector<ll> v;
	ll Distance = 0;
	for(int i = 0; i < n; i++) {
		ll D = (d[1][i] + d[0][i] - d[0][U]) / 2;
		D = d[1][i] - D;
		v.push_back(D);
		if(i == V) Distance = D;
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	ll R = 1e18;
	for(int i = 0; i < v.size(); i++) {
		if(v[i] > Distance) break;
		ll x = (d[1][V] + d[0][V] - d[0][U]) / 2 + Distance - v[i];
		R = min(R, max(v[i], x));
	}
	return R;
}

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:10:13: error: 'solve' was not declared in this scope
   10 |   d[0][i] = solve(0, i);
      |             ^~~~~
towns.cpp:16:13: error: 'solve' was not declared in this scope
   16 |   d[1][i] = solve(U, i);
      |             ^~~~~
towns.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i = 0; i < v.size(); i++) {
      |                 ~~^~~~~~~~~~
towns.cpp:36:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |  return R;
      |         ^
towns.cpp:7:28: warning: unused parameter 'sub' [-Wunused-parameter]
    7 | int hubDistance(int n, int sub) {
      |                        ~~~~^~~