fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define N 1001
  5.  
  6. complex<double> a[N];
  7. #define LIM 100000000
  8.  
  9. void solve()
  10. {
  11. int n,i,j;
  12. double x,y;
  13. sd(n);
  14. for(i=0;i<n;++i)
  15. {
  16. cin >> x >> y ;
  17. a[i].real(x);
  18. a[i].imag(y);
  19. }
  20. int ITER = LIM/n;
  21. double ang = M_PI/ITER;
  22. double ans = 10000.0;
  23. double mnx,mny,mxx,mxy;
  24. for(i=0;i<ITER;++i)
  25. {
  26. mnx = 10000.0,mxx=-10000.0;
  27. mny = 10000.0,mxy=-10000.0;
  28. for(j=0;j<n;++j)
  29. {
  30. //Rotating point a[j] by 'ang' radians
  31. a[j] *= complex<double>(cos(ang),sin(ang));
  32. mnx = min(a[j].real(),mnx);
  33. mxx = max(a[j].real(),mxx);
  34. mny = min(a[j].imag(),mny);
  35. mxy = max(a[j].imag(),mxy);
  36. }
  37. ans = min(ans,max(mxx-mnx,mxy-mny));
  38. }
  39. printf("%.4lf\n",ans);
  40.  
  41. }
  42.  
  43. int main()
  44. {
  45. int t = 1;
  46. //scanf("%d",&t);
  47. while(t--)
  48. {
  49. solve();
  50. }
  51. }
  52.  
  53.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void solve()':
prog.cpp:13:9: error: 'sd' was not declared in this scope
     sd(n);
         ^
stdout
Standard output is empty