ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1613. For Fans of Statistics

How it can be solved?
Posted by Pavel 4 Apr 2008 03:50
How to solve it?)

Quick sort with binary search gets TLE on the 10'th test, and binary search tree - on the 9'th one!
*
Posted by Брэнд 4 Apr 2008 15:28
I did it!
Hint for all: quicksort + binary search works.
Re: *
Posted by Pavel 4 Apr 2008 18:05
Can you show your code?)
Or send it to my e-mail: 0x6fwhite@gmail.com
*
Posted by Брэнд 4 Apr 2008 20:30
I can tell my idea.
a[i] - numbers of people, b[i] - numbers of towns.
I sort it. First sorting - array a, second sorting - if a[i]=a[j] then you must sort b[i] and b[j].
And finally use binary search.
That's all)
Re: *
Posted by Pavel 5 Apr 2008 02:53
Hmm. I do the same) But, I think, I do it some more simple. I use structure <people, year>. I sort the array of this type by people... And then I use binary search. Shit! But it gets TLE! I write my programs in PASCAL. Where do you do it? In C++ ? Maybe it works faster...
Re: *
Posted by Temp_for_one_day 15 Apr 2008 01:59
Pavel, it doesnt matter, pascal or C++, its depends on only your brains, how your program works..
Your algo seems to be right, but think about your bin.search realization. Try to find endless cycle, for example. Good luck ;)
Re: *
Posted by Crash_access_violation 7 May 2008 03:42
thanks... I got AC...

Edited by author 08.05.2008 01:10
Re: How it can be solved?
Posted by georgi_georgiev 2 Sep 2009 02:45
I just sort the array and use lower bound