• + 0 comments
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    
    #include<iostream>
    #include<algorithm>
    using namespace std;
    
    int main()
    {
    	int N;
    	cin>>N;
    	long long X[N], Y[N];
    	int V[N];
    	int i,j,k;
    	for(i=0;i<N;i++) cin>>X[i]>>Y[i]>>V[i];
    	int best=0;
    	for(i=0;i<N;i++)
    		for(j=i+1;j<N;j++)
    		{
    			int sum1=0,sum2=0;
    			for(k=0;k<N;k++)
    			{
    				long long sign = ((Y[k]-Y[i])*(X[j]-X[i])-(X[k]-X[i])*(Y[j]-Y[i])); 
    				if(sign<0) sum1+=V[k];
    				else if(sign>0) sum2+=V[k];
    			}
    			best=max(best,max(
    				max(min(sum1+V[i],sum2+V[j]),min(sum1+V[j],sum2+V[i])),
    				max(min(sum1+V[i]+V[j],sum2),min(sum1,sum2+V[i]+V[j])))
    			);
    		}
    	cout<<best<<endl;
    }