# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1270891 | SmuggingSpun | Odašiljači (COCI20_odasiljaci) | C++20 | 84 ms | 328 KiB |
#include<bits/stdc++.h>
#define taskname "B"
using namespace std;
typedef long long ll;
ll square(int x){
return 1LL * x * x;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
int n;
cin >> n;
vector<int>x(n), y(n);
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i];
}
ll low = 0, high = 8e18, ans;
while(low <= high){
ll mid = low + ((high - low) >> 1LL);
int cnt = 0;
queue<int>q;
vector<bool>vis(n, false);
q.push(1);
vis[1] = true;
while(!q.empty()){
int i = q.front();
q.pop();
cnt++;
for(int j = 0; j < n; j++){
if(!vis[j] && square(x[i] - x[j]) + square(y[i] - y[j]) <= mid){
vis[j] = true;
q.push(j);
}
}
}
if(cnt == n){
high = (ans = mid) - 1;
}
else{
low = mid + 1;
}
}
cout << setprecision(9) << fixed << sqrtl(double(ans) / 4.0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |