# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
101993 |
2019-03-21T09:40:25 Z |
CaroLinda |
Towns (IOI15_towns) |
C++14 |
|
28 ms |
1152 KB |
#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
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 time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1024 KB |
Output is correct |
2 |
Correct |
17 ms |
896 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
19 ms |
1024 KB |
Output is correct |
5 |
Correct |
21 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1024 KB |
Output is correct |
2 |
Correct |
19 ms |
896 KB |
Output is correct |
3 |
Correct |
24 ms |
1052 KB |
Output is correct |
4 |
Correct |
28 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
1024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
1152 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
896 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |