제출 #1152265

#제출 시각아이디문제언어결과실행 시간메모리
1152265itslqOdašiljači (COCI20_odasiljaci)C++20
7 / 70
16 ms8376 KiB
#include "bits/stdc++.h" using namespace std; int main() { int N, M; 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)) / 4; } } 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); }
#Verdict Execution timeMemoryGrader output
Fetching results...