Submission #71624

# Submission time Handle Problem Language Result Execution time Memory
71624 2018-08-25T09:02:47 Z mr_banana Towns (IOI15_towns) C++17
0 / 100
28 ms 928 KB
#include <iostream>
#include "towns.h"
using namespace std;
const int MN=200,inf=1e9;
int dist[MN][MN];
bool mark[MN][MN];
int n;
int getdists(int x){
    int mi=0;
    for(int i=0;i<n;i++){
        if(!mark[x][i]){
            dist[x][i]=dist[i][x]=getDistance(x,i);
            mark[x][i]=mark[i][x]=1;
        }
        if(dist[x][i]>dist[x][mi]){
            mi=i;
        }
    }
    return mi;
}
int hubDistance(int N, int sub) {
    n=N;
    int u=getdists(0);
    int v=getdists(u);
    int ans=inf;
    for(int i=0;i<n;i++){
        int d=(dist[i][v]+dist[i][u]-dist[u][v])/2;
        ans=min(ans,max(dist[i][v],dist[i][u])-d);
    }
    return ans;
}

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:21:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int N, int sub) {
                            ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 544 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 656 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 928 KB Output isn't correct
2 Halted 0 ms 0 KB -