|
|
Is there possible such test: 1 A aa 10 1 1 1 A bb ? If then, what correct solution will be: 'aa 1' or 'aa 1, bb 1'? k - is it a day when person comes to city? Or it is a day when he goes to that city - so person comes in this city on next day? Why in example 25 days, but result has only 20 days? If two cities have same largest amount of money then it shouldn't be counted? Edited by author 02.06.2022 13:52 consider about “list are not decreasing” good point for wa16 i was answering for 0 days use StringComparison.Ordinal to sort cityes Big thanks to author. This is my favourite problem ;) This is Dynamic BD problem. What structers are used? I used set<pair(money,numer)>(red-black tree) and finding,deleteng and inserting of data on each milliarders going, but of course there is more effective solution. SegmentTree did the trick for me Can anyone explain me test #1; London keeps 1st from day 12 to 21 (10 days) and 23 to 25 (3 days). Day 22th London = StPetersburg (=15b). Why output is London 14? The leaders are: 1- 1 London 2- 5 [tie] 6-10 Anadyr 11-11 Moscow 12-15 London 16-20 London 21-21 London 22-22 [tie] 23-25 London It seems you missed day 1. Test 1 M Gor 1000000000 10 1 2 M Goro Ac program: Goro 8 Gor 2 It's wrong:) Your test was added. And you are the only author who doesn't pass it. :) 2 a ca 10 b cb 20 10 0 right answer is cb 10 Good luck! What to do if several cities tie first place? Do we count every of them as a recordsmen or nobody gets this status? It seems to me, that we have this case in first test in example at days 2..5. When several cities are leaders, there is no leader Edited by author 08.01.2012 23:50 It seems that the time limit for this problem is so tight, because I used heap + set and map and I got TLE. Does anybody have any suggestions? Edited by author 22.01.2009 17:08 I've used almost the same structures and AC. Try to optimize your program. Do you use scanf()/printf() for input/output? Thank for your Reply. Yeah, I used scanf/printf for IO. I think I should have reduce the number of maps in my code. I used following structures: map < string , int > city_to_index ;// locate the position of each city in the heap. map < string , string > where;// locate the city in where the billionaire is map < string , LL > how_much;// the amount of money each billionaire has map < string , int > answer;// the answers Do you have any idea to reduce them? One problem that I think that my cause TLE is that I built my heap in array and each time I update my heap I should have change the values in city_to_index. Maybe if I implement it with pointers would be better. I mean, it may be better to build the heap with pointers and for swapping the nodes their addresses in city_to_index remains unchanged. (map<string,node*> city_to_index) IT IS SOMEHOW COMPLICATED FOR ME TO IMPLEMENT IN THAT WAY, DO YOU HAVE ANOTHER IDEA? Edited by author 22.01.2009 19:23 You must before coding be sure in time and space limits of your algo. This is difficult but is core of programming skills. You take right general plan remove bags and get AC. Thanks for your advice. I had though about them before implementing my solution. and I think my running time except the part dealing with maps is O(lg n) per line of input and it is perfectly OK, and that's why I asked in forum about how to get rid of TLE. Edited by author 22.01.2009 19:36 I've reduce the number of maps in my solution and now it gives WA on test #10. Is there any tricky test cases? I used maps, set, vectors, cin & cout and my program works 0.875. There is no need in scanf(). Hello, Could you help me with another input data? All my tests are ok but I am taking wrong answer on the first test. Thank you, I've reached TLE on 7th test. In my opinion this is becauce of slow Console.ReadLine() method. (aprox 2 seconds for 9999 billioners). Please give any hints. After I've added red-black tree I've got TLE9... If somebody will solve this problem using C# please contact me 1(at)igorsky.net Edited by author 27.11.2009 14:03 Edited by author 27.11.2009 14:04 I've got WA5. Could you please give some tests or hints? Thanks in advance. I've found the reason. Bug was related with case-insensetive sorting of output. money of man can be for example 1333333333, firstly i think it`s integer count of billion and get WA6 |
|
|