#include<bits/stdc++.h>
using namespace std;
long double dist(pair<long double,long double>a,pair<long double,long double>b){
return hypot((a.first-b.first),(a.second-b.second))/2;
}
long double counts=INT_MAX;
vector<vector<pair<long double,long double>>>adj(1001);
void dfs(int j ,vector<int>visited,int cnt,long double ans){
if (cnt==visited.size()){
counts=min(ans,counts);
return ;
}
if (ans>counts)return;
for (auto x:adj[j]){
if (visited[x.first]<1){
visited[x.first]++;
dfs(x.first,visited,cnt+1,max(ans,x.second));
visited[x.first]--;
}
}
}
vector<pair<long double,long double>>arr(1001);
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;cin>>n;
for (int i = 0;i<n;++i){
cin>>arr[i].first>>arr[i].second;
}
for (int i = 0;i<n;++i){
for (int j = i+1;j<n;++j){
adj[i].push_back({j,dist(arr[i],arr[j])});
adj[j].push_back({i,dist(arr[i],arr[j])});
}
}
vector<int>visited(n,0);
for (int i = 0;i<n;++i){
dfs(0,visited,1,INT_MIN);
}
cout<<fixed<<setprecision(15)<<counts;
return 0;}
Compilation message
odasiljaci.cpp: In function 'void dfs(int, std::vector<int>, int, long double)':
odasiljaci.cpp:9:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
9 | if (cnt==visited.size()){
| ~~~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Correct |
56 ms |
332 KB |
Output is correct |
3 |
Execution timed out |
1087 ms |
460 KB |
Time limit exceeded |
4 |
Execution timed out |
1085 ms |
716 KB |
Time limit exceeded |
5 |
Execution timed out |
1087 ms |
716 KB |
Time limit exceeded |
6 |
Execution timed out |
1091 ms |
9420 KB |
Time limit exceeded |
7 |
Execution timed out |
1074 ms |
9412 KB |
Time limit exceeded |
8 |
Execution timed out |
1083 ms |
24448 KB |
Time limit exceeded |
9 |
Execution timed out |
1091 ms |
36544 KB |
Time limit exceeded |
10 |
Execution timed out |
1096 ms |
36548 KB |
Time limit exceeded |