# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
16566 |
2015-08-28T05:18:21 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 dp[s][e] = 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;
printf("%d %d\n",fl/2,i);
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 |
18 ms |
1348 KB |
Output isn't correct - wrong output format : Expected EOLN |
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 |
23 ms |
1348 KB |
Output isn't correct - wrong output format : Expected EOLN |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
1348 KB |
Output isn't correct - wrong output format : Expected EOLN |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |