제출 #474140

#제출 시각아이디문제언어결과실행 시간메모리
474140LeeRiseOdašiljači (COCI20_odasiljaci)C++14
70 / 70
121 ms12728 KiB
# include <bits/stdc++.h> # define auto_ac int main using namespace std; struct HA{ long long d,a,b; }; struct point { long long x,y; }; int n; int root[100005]; vector<HA>v; point p[10005]; long long abs(point a, point b) { return ((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int find_root(int x) { if (root[x]==x) return x; return root[x]=find_root(root[x]); } bool cmp(HA a, HA b) { return a.d<b.d; } auto_ac() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for (int i=1;i<=n;i++){ root[i]=i; cin>>p[i].x>>p[i].y; for (int j=1;j<i;j++){ v.push_back({abs(p[j],p[i]),j,i}); } } sort (v.begin(),v.end(),cmp); long long ans; for (int i=0;i<v.size();i++){ if (find_root(v[i].a)!=find_root(v[i].b)){ ans=v[i].d; root[find_root(v[i].b)]=root[find_root(v[i].a)]; } } cout<<fixed<<setprecision(7)<<sqrt(ans)/2; }

컴파일 시 표준 에러 (stderr) 메시지

odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:43:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<HA>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for (int i=0;i<v.size();i++){
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...