# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
16565 |
2015-08-28T04:47:34 Z |
gs14004 |
Towns (IOI15_towns) |
C++14 |
|
23 ms |
1348 KB |
#include "towns.h"
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> pi;
int dp[150][150];
int dist(int s, int e){
if(s == e) return 0;
if(s > e) swap(s,e);
if(~dp[s][e]) return dp[s][e];
return getDistance(s, e);
}
vector<pi> v;
int hubDistance(int N, int sub) {
memset(dp,-1,sizeof(dp));
int p = -1, val = -1, q = -1;
for(int i=1; i<N; i++){
if(val < dist(0, i)){
val = dist(0, i);
p = i;
}
}
val = -1;
for(int i=0; i<N; i++){
if(val < dist(p, i)){
val = dist(p, i);
q = i;
}
}
for(int i=0; i<N; i++){
int fl = dist(p, i) - dist(q, i) + val;
v.push_back(pi(fl / 2, i));
}
sort(v.begin(), v.end());
int R = val;
for(auto &i : v){
R = min(R, max(val - i.first, i.first));
}
return R;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
1348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1348 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
1348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |