# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1014714 | 2024-07-05T10:25:17 Z | MarwenElarbi | Towns (IOI15_towns) | C++17 | 12 ms | 348 KB |
#include <bits/stdc++.h> #include "towns.h" using namespace std; int getDistance(int i, int j); int hubDistance(int N, int sub) { long long mx=0; int one; for (int i = 1; i < N; ++i) { long long cur=getDistance(0,i); if(cur>mx){ mx=cur; one=i; } } vector<long long> a(N,0); int two; mx=0; for (int i = 0; i < N; ++i) { if(i==one) continue; a[i]=getDistance(one,i); if(a[i]>mx){ mx=a[i]; two=i; } } vector<long long> b(N,0); for (int i = 0; i < N; ++i) { if(i==two) continue; b[i]=getDistance(two,i); } long long d=a[two]; long long r=0; for (int i = 0; i < N; ++i) { if(i==one||i==two) continue; long long x=a[i]-b[i]; r=max(r,(x+d)/2); r=max(r,d-(x+d)/2); } return r; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |