LIGHTHSE - Editorial

Please tell me what is wrong. mjOBNe - Online C++ Compiler & Debugging Tool - Ideone.com

@code01aviraj my code is showing right answer for those cases , still getting WA on subtask 1 .
link to my code CodeChef: Practical coding for everyone

@code01aviraj - Testcase is working according to the logic.

@ayushgarg1804 and @mudit1993 I think your code gives wa for the below case. Point 5 is not illuminated.
1
7
0 5
0 -5
5 2
-5 -2

  • 6 3
    6 -3
    0 0

@sarvagya3943
@drift_king
check this test case… i think many people who got 85 and not 15 fail for this type of case… For 85 , the points are far away may be so it passed… for 15 , the test cases may be a bit intelligent :stuck_out_tongue:
1
5
3 0
-3 -1
-3 -2
3 -4
0 1

i think it failed there, and many test cases of same type !

For all those who got WA in subtask1 1/ Try checking your answer when all the points lie on the same line I.e. either the x coordinate or y coordinate for all points remains constant.

Really poor test cases were set up for the question. Corner cases were included in Subtask 1 but were not included in Subtask 2. Many users got away with 85 points although there was a glitch in their approach or logic.

This should not have happened.

There is a small correction in the Editorial.

In sub task 2, the word ‘first’ set has to be changed to ‘second’ set in the 4th point.

If in the first set, there is an island such that it has the maximum y-coordinate amongst all given N islands, then we can place a lighthouse on it facing in the SW direction. This will illuminate all the islands.

to

If in the second set, there is an island such that it has the maximum y-coordinate amongst all given N islands, then we can place a lighthouse on it facing in the SW direction. This will illuminate all the islands.

2 Likes

I am convinced that there are a few missing solutions in this problem. I have tested my solution with all the tricky edge cases mentioned in the comments so far. And all of them have given the correct output so far. I am yet to come across a test case for which my solution fails. I still have no idea why my solution got 85pts only. I would be grateful if someone can come up with a test case for which my solution fails. Here’s the link : https://www.codechef.com/viewsolution/8033551

@Author: why not provide the test cases ? I think it would make the discussion easier. A lot of people seem to think there is no bug in their solution…

@admin please provide the test cases.my code only works for 3rd task of 2nd subtask.wa in rest.could anyone tell me the reaso behind it?

Could anybody point the test case for which my solution fails for sub task 1 ?? It runs fine with the cases mentioned in previous comments .
https://www.codechef.com/viewsolution/8119136

can anyone tell me why my 1st subtask is coming to be wrong CodeChef: Practical coding for everyone ???

@code01aviraj the latest case you provided 1 7 0 5 0 -5 5 2 -5 -2 - 6 3 6 -3 0 0 has an extra space between - & 6 in the point 5. If you remove that space it gives the correct output with point 5 being illuminated. Also @lordshiva1996 your test case also gave the correct output. If its possible please provide the test cases for which it gives wrong answer in subtask 1.

hello one light house per quadrant is not enough to lighten all islands in that quadrant?

In problem specification:-
Each lighthouse can light only one of the 4 quadrants: North-Western, North-Eastern, South-Western or South-Eastern=========
In editorial:-
If in the first set, there is an island such that it has the minimum y-coordinate amongst all given N islands, then we can place a lighthouse on it facing in the NE direction. This will illuminate all the islands.{spread in more than one quadrant}
Why like this?on what basis one can think against problem statement

https://www.codechef.com/viewsolution/8278876

can anyone tell me why my code isn’t working ??

Why am i getting WA…can anyone please find out the bug!!

Check the output format. It must be wrong. That’s why its giving WA.

can you tell me where i am wrong? mjOBNe - Online C++ Compiler & Debugging Tool - Ideone.com