# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
670179 |
2022-12-08T08:44:48 Z |
Astrayt |
Towns (IOI15_towns) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#include "towns.h"
using namespace std;
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pii pair<int,int>
#define pb push_back
int dist[110][110];
int getDistance(int i, int j){
return dist[i][j];
}
int hubDistance(int n, int sub){
int LCC = 0;
vector<vector<int>> D(n, vector<int>(n, 0));
for(int i = 0; i < n; ++i)
for(int j = i + 1; j < n; ++j)
D[i][j] = D[j][i] = getDistance(i, j);
int lb = 0, R = 1e9;
while(true){
int mn = 1e9;
pii pt;
for(int i = 1; i < n; ++i){
for(int j = i + 1; j < n; ++j){
int k = (D[0][i] + D[0][j] - D[i][j]) / 2;
if(k < mn && k > lb) mn = k, pt = make_pair(i, j);
}
}
if(mn == 1e9) break;
int r = mn;
for(int i = 0, u = pt.first, v = pt.second; i < n; ++i){
if(i == u || i == v) continue;
int rr = D[u][i] + D[v][i] - D[u][v];
rr /= 2;
r = max(rr, r);
}
R = min(R, r);
lb = mn;
}
return R;
}
/*
void solve(int sub){
int n; cin >> n;
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
cin >> dist[i][j];
}
}
cout << hubDistance(n, sub) << '\n';
}
signed main(){
starburst
int t = 1, s; cin >> s >> t;
while(t--) solve(s);
}*/
Compilation message
towns.cpp: In function 'long long int hubDistance(long long int, long long int)':
towns.cpp:31:12: warning: conversion from 'long long int' to 'double' may change value [-Wconversion]
31 | if(mn == 1e9) break;
| ^~
towns.cpp:16:9: warning: unused variable 'LCC' [-Wunused-variable]
16 | int LCC = 0;
| ^~~
towns.cpp:15:28: warning: unused parameter 'sub' [-Wunused-parameter]
15 | int hubDistance(int n, int sub){
| ^
/usr/bin/ld: /tmp/cccL3Xws.o: in function `main':
grader.c:(.text.startup+0x83): undefined reference to `hubDistance(int, int)'
collect2: error: ld returned 1 exit status