Sort by

recency

|

21 Discussions

|

  • + 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;
    }
    
  • + 1 comment
    #include <bits/stdc++.h>
    using namespace std;
    
    const int inf = (1 << 28);
    const double pi = (2.0 * acos(0.0));
    const double eps = 1e-9;
    
    typedef long long lli;
    
    #define _rep(i, a, b, x) for (i = (a); i <= (b); i += x)
    #define rep(i, n) _rep(i, 0, n - 1, 1)
    
    const int MX = 100;
    int n;
    struct PointF {
      lli x, y, v;
      void scan() { cin >> x >> y >> v; }
    };
    PointF P[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))
    int main(void) {
    
      int i, j, k;
      while (cin >> n) {
        rep(i, n) P[i].scan();
        lli a, 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 line
          ans = 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);
      }
      return 0;
    
  • + 0 comments

    Thanks for assigning this piece of article. Truly, it's a new experience for me. It's the first time that I'll get help from biography writing services to solve my task easily. The link helped to get more information about it easily. I hope to view more data like this.

  • + 2 comments

    I had to pretty much entirely rewrite it so it would conform to your expected https://foxdownload.org out, despite the fact that it performed perfectly.

  • + 1 comment

    This problem is interesting, but it can be solved by brute force. I think it would be even more interesting - and difficult - to have an equivalent problem not solvable by brute force.