Show all threads Hide all threads Show all messages Hide all messages |
Strange problem | Programmer | 1436. Billboard | 30 Oct 2019 02:36 | 3 |
I used ternary search for this problem limits -50000:50000 leads to wa18 -100000:100000 got wa1 -90000:90000 was AC is there a normal solution without finding such segment? Really strange! I got AC with 90000 limit too, using ternary search for an angle. Maybe, limits should be specified by variables? |
WA#18 | Oleg1209 | 1436. Billboard | 20 Jun 2019 16:21 | 2 |
WA#18 Oleg1209 12 Oct 2015 13:09 What is the test 18? I really don't understand it... I wrote solution with ternary search, and I think that there is problem with accuracy of calculations. Have anybody this problem? P.S. Sorry for my bad english :) You should find number extremum of function. Spoiler: It isn't true, that there is only one. Edited by author 20.06.2019 16:21 |
Could anyone help with Test 16? | Alflex | 1436. Billboard | 29 Aug 2018 19:38 | 2 |
I have WA, but I don't guess at the feature of this test. Does anyone have a problem with this test? Please comment your trick. You should be careful with the point (X, 0) that lies on line A + (B - A). The angle should be 0 there, but because of precision issues we all love this case can break ternary search. |
Mathematics Behind the scene | KNIGHT0X300 | 1436. Billboard | 3 Apr 2018 02:04 | 2 |
There exist a closed form for the answer. hence the solution is O(K). and it is easy to find with Maxima: d2(x1,y1,x2,y2):=(x2-x1)^2+(y2-y1)^2; x1: 0; /* even simpler if we assume x1=0 */ a1: d2(x1,y1,x,0); a2: d2(x2,y2,x,0); d: d2(x1,y1,x2,y2); /* the triangle */ ca: (a1+a2-d)/(2*sqrt(a1*a2)); /* cos of the angle */ s:solve(diff(ca,x)=0,x),ratsimp; /* solutions have y2-y1 as the denominator, so */ s1:solve(diff(ca,x)=0,x),y2=y1,ratsimp; /* let us solve it in this special case */ |
Why could you guys assert that it is feasible to use the specific algorithm? | zmj159 | 1436. Billboard | 16 Nov 2015 10:33 | 1 |
Pay attention that the algorithm is used only the function has some specific property. But unfortunately, the property does not always exist. So why do you take the algorithm for granted? |
To all who have WA#6 | ftc | 1436. Billboard | 27 Feb 2013 14:15 | 2 |
Try to check return values of trigonometric routines. For example, if you use atan2, make sure that if returned angle is negative you take an absolute value of it (not just add 2 * PI). Good luck! Mine was failing WA6 due to integer overflow -- remember to convert the data to float early :) |
Test #5 | Slobodan | 1436. Billboard | 27 Feb 2013 13:04 | 9 |
Can someone give me test number 5 and if possible write the solution? Thank you. EDIT: It also will be helpful if someone give me some tests with solutions and maybe some "tricky" test. EDIT2: Got AC. Edited by author 13.05.2008 03:18 Edited by author 15.05.2008 16:13 I don't know what is "bug" in your algorithm, but in my was that I made mistake while I was subtracting angles. I still do not know what is test case # 5. Do you find out what the problem was In the test #5 x1=x2. I had WA on this test because of wrong processing of this case. Edited by author 14.11.2008 22:29 Test 5 x1==x2 && y1>0 && y2>0 Solution: ternary search in extending interval :) Edited by author 21.03.2010 13:27 |
Weak tests again | I&K | 1436. Billboard | 15 Jan 2011 14:43 | 6 |
My solutions based on the wrong assumption that the view angle has only one maximum on abscissa axis (and with some tricks regarding to range of search or partition method in ternary search) pass all tests. Seems that more tests needed. Can the view angle has more than one maximum? Yes. It's zero at negative infinity, increases when moving to positive infinity and than decreases to zero at the point of intersection of the line containing billboard segment and the abscissa axis (assuming the segment itself doesn't intersect the axis). If we continue to move the view point to the positive infinity, the angle increases and decreases again. Now I understand what you meen. I searched maximum on the segment between point of intersection of board with abscissa axis and positive or negative infinity. I considered only this segment and was surprised that there can be more than one maximum on it. Some new tests were added. Now your solutions got WA. But if you change constants in your ternary search you will get AC again. You are right. I've changed "infinity" from 10^6 to 10^4 and got AC. Can you explain why? It's the secont time I decreased segment for search and got AC. |
does billboard have a "front side" ? | Kolyanich | 1436. Billboard | 15 Jan 2011 00:18 | 2 |
In other words, is for input {A, B, C, D} result always equal to result for input {C, D, A, B} ? Yes, program with exchanging points' coordinates got AC. |
weak tests?... | tereshinvs | 1436. Billboard | 14 Jan 2011 01:54 | 2 |
My programm search the greatest angle in x in [x1..x2] and got AC. But it's wrong. For example in test 0 3 1 1. PS Maybe i'm wrong Edited by author 13.01.2011 21:20 New tests were added. 84 authors lost AC. Edited by author 14.01.2011 02:29 |
PPERM CAN YOU HELP ME TEST#5 OF 1436 ? | K-A-R-E-N | 1436. Billboard | 14 Jan 2009 22:39 | 2 |
Test 5 doesn't matter! When we formulate our solution mathematically rightly tests may be from 1 to 1000 and so on.You should your self determine where your house may take winds. |
WHO CAN HELP ME TEST#5 ? | K-A-R-E-N | 1436. Billboard | 14 Jan 2009 17:47 | 1 |
|
Addition to the problem description | LSBG | 1436. Billboard | 14 Dec 2008 00:18 | 2 |
I don't keep much hope on somebody looking in the discussion section for this problem with all that time passed after it's introduction but I would like to make the note that the view point should be with non-negative x coordinate. This is not clear from the problem statement. I still haven't passed the whole problem but adding this logic to my solution upgraded me from wa8 to wa9. Any other tricks someone has noticed? No, view point may have negative x coordinate, so there should be another reason for your advance from 8-th to 9-th test... |
Some Bugs about 1436 | t__nt | 1436. Billboard | 26 Jul 2008 23:14 | 3 |
I've compared my computer with my friend's accepted program. I found that his main algorithm is to find the maximal viewing angle between (x1,0) and (x2,0) using binary search. But I have a random data like this "-41 328 150 467" my program output 0.528878 {which meet the peak value at (173.423285,0) on the right side of (x2,0)} but his program output 0.527316 {which meet the peak value at (150,0)} Must the programmer view the Billboard bewteen (x1,0) and (x2,0)? If I misunderstood the description of this problem,please tell me the right one. Thank you very much. my AC program returns 0.528878. Thank you very much! I will check my solution more carefully. |
wa#6 | Nikola | 1436. Billboard | 21 May 2008 06:07 | 1 |
wa#6 Nikola 21 May 2008 06:07 Please, give me test#6 or answer for test#6,or tell me what could be a problem? |
Test #6 | Smiljko | 1436. Billboard | 13 May 2008 20:39 | 5 |
Can anybody tell me what is correct answer for this test, please? Test is: -1000 -1000 1000 1 Edited by author 12.05.2008 21:15 But I output this number, but it's WA? Why? How do you know that's the input data? My AC program outputs 3.141593... Sorry, i have just now noticed that this aren't correct input data... Can anybody give me correct datas, please? |
OMG why WA #6 ?!? | Dimke | 1436. Billboard | 13 May 2008 20:32 | 1 |
Plz help i got WA on test #6. Can you give me some tests? Edited by author 13.05.2008 20:38 |
Why my program have WA(6)??? | Shambala | 1436. Billboard | 12 May 2008 19:57 | 6 |
Hi! My math solution is absolute correct! I know that test #6 is: -1000 -1000 1000 1 (Bin Search rulez :-)))) The correct answer on it is 3.141593 my program give this answer, but got WA. WHY??? It is impossible!!! Help me please... Bye! pi is indeed the correct answer for this case. have you tried output with moy digits after decimal point? there might be something wrong with your detection. i suggest you checking the value your trigonometric functions produce. Good Luck! Edited by author 03.03.2006 13:58 I happen to have a problem with the same test case... Would anyone be able to give some more information about - well, anything? ~edit~ Never mind, I got AC after moving the billboard so that the coordinates suit me :) Edited by author 06.05.2008 15:26 Edited by author 06.05.2008 15:27 So, what is correct answer for #6? Edited by author 12.05.2008 19:57 Edited by author 12.05.2008 19:57 Edited by author 12.05.2008 19:57 |
help with tests | dusan | 1436. Billboard | 10 May 2008 18:58 | 2 |
how can i see whats test #5? can anyone post me if he knows pls can anyone add any test examples, and the answers please it gives me wrong answer on test #5 |
Admins, please add the test | Fyodor Menshikov | 1436. Billboard | 17 Jan 2007 05:25 | 1 |
The test set for the problem awhile does not contain case (x1=x2 and y1*y2=0). For this case answer is PI/2, while all other cases y1*y2<=0 have answer PI. The test case credits: Igor E. Tuphanov. |