Submission #1152277

#TimeUsernameProblemLanguageResultExecution timeMemory
1152277itslqOdašiljači (COCI20_odasiljaci)C++20
70 / 70
21 ms16556 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int N, M = 0; cin >> N; vector<pair<int, int>> coords(N); for (int i = 0; i < N; i++) cin >> coords[i].first >> coords[i].second; vector<vector<int>> dist(N, vector<int>(N)); for (int i = 0; i < N; i++) { for (int j = 0; j < i; j++) { dist[i][j] = dist[j][i] = ((coords[i].first - coords[j].first) * (coords[i].first - coords[j].first) + (coords[i].second - coords[j].second) * (coords[i].second - coords[j].second)); } } int U = N; pair<int, int> curr; vector<bool> visited(N); priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; pq.emplace(0, 0); while (U) { curr = pq.top(); pq.pop(); if (visited[curr.second]) continue; visited[curr.second] = 1; M = max(M, curr.first); U--; for (int j = 0; j < N; j++) { if (!visited[j]) { pq.emplace(dist[curr.second][j], j); } } } cout << fixed << setprecision(8) << sqrt((double) M) / 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...