Submission #101993

#TimeUsernameProblemLanguageResultExecution timeMemory
101993CaroLindaTowns (IOI15_towns)C++14
25 / 100
28 ms1152 KiB
#include "towns.h" #include <bits/stdc++.h> #define lp(i,a,b) for(int i = a ; i < b ; i++) #define ff first #define ss second #define pii pair<int,int> #define INF 1000010*110 const int MAXN = 120 ; using namespace std; int m[MAXN][MAXN] ; void ini() { lp(i,0,MAXN) lp(j, 0 , MAXN) m[i][j] = -1 ; } int query(int A ,int N) { pii p = pii(-1,-1) ; lp(i,0,N) { if( i == A ) continue ; m[A][i] = getDistance(A,i) ; if(m[A][i]>p.ss) p = pii( i , m[A][i] ) ; } return p.ff ; } int hubDistance( int N , int sub ) { ini(); int B = query(0 , N) ; int C = query(B , N) ; query(C , N) ; int R = INF ; lp(i,0,N) if(i!=C and i!=B) { int b = (m[B][i]+m[C][i] - m[B][C])/2 ; R = min( R , max( m[B][i] , m[C][i] ) - b ) ; } return R ; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:34:30: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance( int N , int sub )
                              ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...