We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<bits/stdc++.h>usingnamespacestd;constintinf=(1<<28);constdoublepi=(2.0*acos(0.0));constdoubleeps=1e-9;typedeflonglonglli;#define _rep(i, a, b, x) for (i = (a); i <= (b); i += x)#define rep(i, n) _rep(i, 0, n - 1, 1)constintMX=100;intn;structPointF{llix,y,v;voidscan(){cin>>x>>y>>v;}};PointFP[MX+10];///+ ve => ac turns left from ab , - ve => ac turn right from ab , 0=> same///direction or just reverse - 0 or pi#define _direction2d(a, b, c) \ ((b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y))intmain(void){inti,j,k;while(cin>>n){rep(i,n)P[i].scan();llia,b,ans=0;rep(i,n)rep(j,n){if(i>=j)continue;a=b=0;rep(k,n){//Here, at first, you are keeping the two fixed points on the line.if(_direction2d(P[i],P[j],P[k])>0)a+=P[k].v;if(_direction2d(P[i],P[j],P[k])<0)b+=P[k].v;}//You can shift the line slightly and keep the //points in one side of the lineans=max(ans,min(a+P[i].v+P[j].v,b));ans=max(ans,min(a,b+P[i].v+P[j].v));//You can rotate the line slightly and keep the //points in opposite side.ans=max(ans,min(a+P[i].v,b+P[j].v));ans=max(ans,min(a+P[j].v,b+P[i].v));}printf("%lld\n",ans);}return0;
Stars
You are viewing a single comment's thread. Return to all comments →