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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. NP Complete
  4. Spies, Revised
  5. Discussions

Spies, Revised

Problem
Submissions
Leaderboard
Discussions

    You are viewing a single comment's thread. Return to all comments →

  • i_rnb
    4 years ago+ 0 comments

    Minimum conflict algorithm was very slow for me. But I could optimize it using intensive parallelism and an observation to count straight line conflicts.

    The observation is, if and are two lattice points, then an other lattice point on the straight line would have this form,

    where and .

    Using this would reduce number of iteration in huge factor. Parallelism helps because most of the work in each iteration is independent.

    Using this, I was able to find a solution within one hour.

    5|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature