Submission #473780

#TimeUsernameProblemLanguageResultExecution timeMemory
473780MamdouhNOdašiljači (COCI20_odasiljaci)C++17
0 / 70
2 ms332 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" vector<pair<int,int>>points; bool comp(pair<int,int> a,pair<int,int> b) { int x = a.first+a.second; int y = b.first+b.second; if(x==y) { int aa = min(a.first,a.second); int bb = min(b.first,b.second); return aa<bb; } return x<y; } int pwr(double a,double b) { int ret=1; while(b--)ret*=a; return ret; } main() { int n; cin>>n; for(int i=0;i<n;i++) { int a,b; cin>>a>>b; points.push_back({a,b}); } sort(points.begin(),points.end(),comp); double ans = 1e9; for(int i=0;i<n-1;i++) { double x1 = points[i].first; double y1 = points[i].second; double x2 = points[i+1].first; double y2 = points[i+1].second; double dist = sqrt( pwr(x2-x1,2) + pwr(y2-y1,2) ); dist/=2; ans = min(ans,dist); } cout<<fixed<<setprecision(7)<<ans<<endl; }

Compilation message (stderr)

odasiljaci.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...