Submission #674617

#TimeUsernameProblemLanguageResultExecution timeMemory
674617MacPhucKhangOdašiljači (COCI20_odasiljaci)C++17
70 / 70
429 ms9292 KiB
#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 timeMemoryGrader output
Fetching results...