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

×

PLANEDIV - getting WA

Hi,

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:
https://ideone.com/sfoJ0T

Here is a link for the problem statement:
https://www.codechef.com/problems/PLANEDIV

Thanks in Advance

asked 18 Dec '15, 00:34

pranjvas's gravatar image

2★pranjvas
64
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 :-
1
1
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).

link

answered 20 Dec '15, 07:39

ps06756's gravatar image

4★ps06756
1812
accept rate: 9%

edited 20 Dec '15, 07:41

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×1,914
×319
×174
×160
×67
×61
×5

question asked: 18 Dec '15, 00:34

question was seen: 1,105 times

last updated: 20 Dec '15, 07:41