# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
498774 | Karabasan | Odašiljači (COCI20_odasiljaci) | C++17 | 145 ms | 24940 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define fast1 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,avx")
#pragma GCC optimize("unroll-loops")
int n;
vector<pair<double,int> > v[1005];
pair<int,int> p[1005];
int vis[1005];
double mx;
void solve()
{
cin>>n;
for(int i=0;i<n;i++)
cin>>p[i].first>>p[i].second;
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
v[i].push_back({-sqrt(abs(p[i].first-p[j].first)*abs(p[i].first-p[j].first)+abs(p[i].second-p[j].second)*abs(p[i].second-p[j].second))/2.0,j});
v[j].push_back({-sqrt(abs(p[i].first-p[j].first)*abs(p[i].first-p[j].first)+abs(p[i].second-p[j].second)*abs(p[i].second-p[j].second))/2.0,i});
}
}
priority_queue<pair<double,int> > pq;
pq.push({0,0});
while(!pq.empty())
{
double yol=pq.top().first;
int x=pq.top().second;
pq.pop();
if(vis[x]==1)
continue;
vis[x]=1;
mx=min(mx,yol);
for(int i=0;i<v[x].size();i++)
{
if(vis[v[x][i].second])
continue;
pq.push({v[x][i].first,v[x][i].second});
}
}
cout<<-mx<<endl;
}
signed main()
{
//freopen ("lca.gir","r",stdin);
//freopen ("lca.cik","w",stdout);
fast1
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |