Rotary jam

Original link: https://www.shuizilong.com/house/archives/rotating-calipers/

blank.jpg

   #include <lastweapon/geometry>   using namespace lastweapon;   using namespace CG;      typedef vector<Po> VP;      #define suc(x) (x+1==n?0:x+1)   DB rc(const VP&P){       int n = SZ(P)-1, j = 1; DB d2 = 0; REP(i, n){           while (dett(P[i+1]-P[i], P[j+1]-P[j])>0) j=suc(j);           checkMax(d2, max(dist2(P[i], P[j]), dist2(P[i+1], P[j])));       }       return d2;   }      VP P; int n;      int main(){      #ifndef ONLINE_JUDGE       freopen("in.txt", "r", stdin);       //freopen("out.txt", "w", stdout);   #endif          RD(n); P.resize(n); REP(i, n) P[i].in();       printf("%.0f\n", rc(getCH(P)));   }      

This article is reprinted from: https://www.shuizilong.com/house/archives/rotating-calipers/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment