답안 #498776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
498776 2021-12-26T10:28:52 Z Karabasan Odašiljači (COCI20_odasiljaci) C++17
42 / 70
132 ms 24900 KB
#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<<setprecision(12)<<-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

odasiljaci.cpp: In function 'void solve()':
odasiljaci.cpp:39:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(int i=0;i<v[x].size();i++)
      |                     ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Incorrect 1 ms 588 KB Output isn't correct
5 Incorrect 2 ms 716 KB Output isn't correct
6 Correct 30 ms 6592 KB Output is correct
7 Correct 30 ms 6600 KB Output is correct
8 Correct 73 ms 20636 KB Output is correct
9 Incorrect 128 ms 24900 KB Output isn't correct
10 Incorrect 132 ms 24884 KB Output isn't correct