# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
674617 | MacPhucKhang | Odašiljači (COCI20_odasiljaci) | C++17 | 429 ms | 9292 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pdi pair <double, int>
using namespace std;
struct Coord{
int x, y;
};
vector <Coord> a;
vector <double> d;
vector <vector <double>> w;
int n;
double ans = 0;
double Distance(Coord i, Coord j){
return sqrt(pow(i.x - j.x, 2) + pow(i.y - j.y, 2));
}
double Dijkstra(){
priority_queue <pdi, vector <pdi>, greater <pdi>> pq; pq.push({d[0], 0});
while (!pq.empty()){
int p = pq.top().second; pq.pop();
ans = max(ans, d[p]);
d[p] = -1;
for (int k = 0; k < n; k++)
if (d[k] > w[k][p]){
d[k] = w[k][p];
pq.push({d[k], k});
}
}
return ans / 2;
}
void Solve(){
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
w[i][j] = Distance(a[i], a[j]);
cout << fixed << setprecision(7) << Dijkstra();
}
int main() {
cin >> n;
a.resize(n);
d.resize(n, INFINITY); d[0] = 0;
w.resize(n, vector <double> (n));
for (auto &i : a)
cin >> i.x >> i.y;
Solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |