Show all threads Hide all threads Show all messages Hide all messages |
Is the segment close or open? | Ade [FDU] | 1469. No Smoking! | 28 Mar 2024 08:06 | 2 |
What the output of? 2 0 0 1 1 1 1 2 2 |
WA in 11 test help please | Nabi | 1469. No Smoking! | 28 Mar 2024 08:03 | 2 |
i used redblack tree on python and using a quick input using stdin i passed test 8 time limit and met evening at 11 ok, it was a perpendicular but what about 15 test |
How to cheat and get AC. | Teacher30 (Burunduk1) | 1469. No Smoking! | 5 Apr 2013 17:19 | 1 |
Let project all segments to some line (x,y --> z=ax+by) and try all pairs of segments, which have an intersection of projections. To do it just sort events "open segment", "close segment" and brute force pairs. You will get TL. Yet. Now let try 4 lines: (a,b) = (1,0) (0,1) (1,1) (1,-1). At first, let estimate number of pairs to process for each line in O(nlogn) time. Now that we may choose line, which produces minimal mumber of pairs. AC in 0.937 seconds. id = 4870936. |
Clarification | ibra (TNU) | 1469. No Smoking! | 25 Mar 2013 23:44 | 3 |
могут ли сигареты накладываться друг на друга? например: 0 0 0 2 0 1 0 3 спасибо конечно за совет, но я знаю что эта задача есть и в Кормене и на емаксе. Я просто уточнял могут ли отрезки накладываться |
yahoo | nikonoff (ONPU) | 1469. No Smoking! | 1 Dec 2008 16:39 | 1 |
yahoo nikonoff (ONPU) 1 Dec 2008 16:39 using red-black tree for line-sweeping algorithm |
What's the "good" algo for this problem | Todor Tsonkov | 1469. No Smoking! | 30 Aug 2008 04:41 | 12 |
I coded for 10 minutes brute force which got TL on test 4.. any ideas about the "good" algo ? Haha :) Some more hints ;) You can implement stuff, described in Cormen, easily, using set. That's what I was trying to say. Ilya Razenshteyn. There is obvious "slide line" algo, that can be applied in O(NlogN). But there is a little problem here: perpendicular to ox line segments... It's not problem! I don't exam this case and got AC.
Can you explain a little more about this algo ? This isn't problem too. Just rotate all points by the constant angle. const angle=pi/60; var x,y,buf1,buf2:real; begin ... Buf1:=x; Buf2:=y; x:=Buf1*cos(angle)-Buf2*sin(angle); y:=Buf1*sin(angle)+Buf2*cos(angle); Edited by author 01.04.2007 16:14 I solved for me the little problem of vertical segments by applying affine matrix [2 3] [5 -7] or any other to given coordinates. As result algo from Cormen can be taken without any changes. Edited by author 13.07.2007 17:09 As far as me, I used some my heuristics with vertical segments: First, when reading points i makred point with lesser x cordinate as enter point. I sorted points by X, and if X are eual then sorted by enter mark. This assumes then enterpoint will be before exitpoint of segment in set. Vertical segments are easy to treat. Just sort X ascendingly and for equal X sort Y ascendingly. When you add vertical segment, consider its topmost Y coordinate during comparisons, and when you add some other segment, assume equality when its scan-line ordinate is compared to that one of vertical segment in the set. Such behavior is identical to the one we'd apply to the segments set after rotating it for small enough angle. Another way to see that - apply skew affine transform x2 = x+y*1e-6 y2 = y and see how formerly vertical segments are handled in this case. Edited by author 30.08.2008 04:52 |
Problem 1469 "No smoking!" has been rejudged (+) | Vladimir Yakovlev (USU) | 1469. No Smoking! | 22 Aug 2007 20:46 | 1 |
New tests has been added. 7 authors have lost AC. |
WA#1 :) test #1 is sample test, isn't? | Alias (Alexander Prudaev) | 1469. No Smoking! | 19 Jul 2007 14:29 | 3 |
i implement sweep line algorithm, using STL set Hmmm... I also have WA-1 but my program works correct on the samples |
I use Treap and have TL#15! | EfremovAleksei | 1469. No Smoking! | 8 Nov 2006 13:51 | 2 |
I don't understand, how i can get AC! Did Anybody got Ac, using decart tree? I found my bug and got AC. Thanks to author for good problem! |
Help, I have WA 16 | IFIT | 1469. No Smoking! | 18 Oct 2006 16:16 | 2 |
I use "slide line" algorithm from "I to A", Cormen; Program works correct with vertical lines; What can be wrong- may be some tests? All right, I find the problem. When i debug test on my comp with brute force method, i found that function that cross cuts in "slide line" method works incorrect ( i'll say no body where :) ). I now I have SA! |
Interesting | Alex_SyktSU | 1469. No Smoking! | 10 Oct 2006 02:33 | 2 |
Interesting to now, why when I write like this: int map[50001][4]; int N; cin >> N; for (int i=0; i<N; i++) { scanf("%d %d %d %d", &map[i][0], &map[i][1], &map[i][2], &map[i][3]); ... I got wa2 and when I write like this: for (int i=0; i<N; i++) { cin >> map[i][0] >> map[i][1] >> map[i][2] >> map[i][3];.. I succesfully pass second test ? |
What the answers for this tests? | Fetisov Kiselev USTU_RI - RTF | 1469. No Smoking! | 24 Sep 2006 15:09 | 2 |
Test 2 0 0 5 0 3 0 15 0 And this test 2 0 0 5 0 3 0 3 15 It seems to be YES 1 2 for both. |