CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2020
    Posts
    5

    Please help me solve this problem

    Here is the link to the problem -
    https://www.codechef.com/FEB20B/problems/CHEFRAIL

  2. #2
    Join Date
    Feb 2017
    Posts
    677

    Re: Please help me solve this problem

    The brute force solution is to generate all possible triplets (corners of a triangle) and select those that form a right triangle.

    This solution can be improved. By geometric reasoning it is possible to show that given the two points of a triplet that must be on the same axis, the third point in the triplet that lies on the other axis can be calculated very quickly. This allows for an algorithm with quadratic complexity and that may be enough to get the 60 points prize money.
    Last edited by wolle; February 17th, 2020 at 03:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured