You are not logged in. Please login at to post your questions!


PLANEDIV - getting WA


I've submitted the solution for the problem PLANEDIV, but am unable to figure out the problem in my code as it is getting rejected. I've created a set object and have stored all the line coefficients in the set. I've also overloaded the < and > operators of the set, such that if there is a repeated line with different a,b and c, it will not be added to the set. Then I use a map to count the maximum number of lines in the set with the same slope. But still getting wrong answer. Any help would be appreciated.

Here is the link to my solution:

Here is a link for the problem statement:

Thanks in Advance

asked 18 Dec '15, 00:34

pranjvas's gravatar image

accept rate: 0%

edited 20 Dec '15, 01:19

There are two mistakes in your code :-
1) Your code doesn't provide correct answer for test cases where N = 1, ex consider the test case :-
10 20 30
It should provide the answer as 1, but it is providing the answer as 0.

2) You don't take gcd of A,B as well as C. The number by which you have to divide the coefficients is gcd(A,B,C) not just gcd(A,B).


answered 20 Dec '15, 07:39

ps06756's gravatar image

accept rate: 9%

edited 20 Dec '15, 07:41

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 18 Dec '15, 00:34

question was seen: 1,105 times

last updated: 20 Dec '15, 07:41