Submission #71631

# Submission time Handle Problem Language Result Execution time Memory
71631 2018-08-25T09:19:08 Z mr_banana Towns (IOI15_towns) C++17
25 / 100
37 ms 2356 KB
#include <bits/stdc++.h>
#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(x!=i && !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) {
    memset(mark,0,sizeof mark);
    n=N;
    int u=getdists(0);
    int v=getdists(u);
    getdists(v);
    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 Correct 20 ms 504 KB Output is correct
2 Correct 20 ms 568 KB Output is correct
3 Correct 3 ms 568 KB Output is correct
4 Correct 26 ms 600 KB Output is correct
5 Correct 26 ms 780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 780 KB Output is correct
2 Correct 37 ms 1120 KB Output is correct
3 Correct 24 ms 1768 KB Output is correct
4 Correct 25 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2300 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 2300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2356 KB Output isn't correct
2 Halted 0 ms 0 KB -