Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Страница 2 |
solution | wangbicheng1 | 1144. The Emperor's Riddle | 13 ноя 2015 09:22 | 1 |
Assume each general's gold a[1],a[2],...,a[m] divide them into b[1]&c[1],b[2]&c[2],...,b[m]&c[m],and b[1]+c[1]=a[1],b[2]+c[2]=a[2],... (b[i] can be any partition from a[i]) Then sort b from big to small, sort c from small to big. We can prove that between b[1]+c[1],b[2]+c[2],...,b[m]+c[m], the biggest minus the smallest would not be worse than the previous one. Continuously do this and we'll get the answer. This solution is developed by Wenbin Tang. Thanks to him! |
4 MB Java 1.7? | raggzy | 1144. The Emperor's Riddle | 4 апр 2014 04:38 | 2 |
Well, i spent a lot of time for optimizing memory stuff in Java, but it seems that even empty program takes 5 MB. I'm kindly asking administration to increase memory limit to doable one (9-10 MB). Solved. Ignore pls. HINT: Don't use java.util.Scanner! |
Hint | Серовиков Андрей | 1144. The Emperor's Riddle | 21 апр 2013 02:43 | 1 |
Hint Серовиков Андрей 21 апр 2013 02:43 First of all, it should be noted that in the literature such problem is known as "bottleneck multiple subset sum problem" (B-MSSP) and it's a variation of knapsack problem. This problem even with such restrictions is an NP-complete. So, the aproximate solution even needed. Precision??? The precision is mystic (based on statement of the problem). I don't know how other people solved this problem, but I aproximate solution through aproximation of every pair of subsets. To aproximate a pair of subsets we need to solve B-MSSP just for 2 subsets. This can be solved in O( (|S1|+|S2|)*max(Ai) ) time and O( max(Ai, |S1|+|S2|) ) space complexity. |
Страница 1 |
Statement | Yermak | 1144. The Emperor's Riddle | 17 ноя 2012 05:44 | 1 |
I suggest to replace "K is the maximum result" with "K is the maximum difference of gold". |
Any fast solutions? | YSYMYTH | 1144. The Emperor's Riddle | 14 авг 2012 15:40 | 1 |
If so, please send one to ysymyth@gmail.com please! |
Algo | xurshid_n | 1144. The Emperor's Riddle | 27 мар 2012 13:29 | 2 |
Algo xurshid_n 19 янв 2012 18:52 A[] - values. B[] - rewards. 1. sort A[] by not increasing order. 2. i=1..n B[j] += A[i], which B[j] - minimal value of B[]. 3. while ( not <= K) try to equate with minimal of B[] and all other B[]s. try to equate with maximal of B[] and all other B[]s. 4. print. only how to equate ? use simple DP!
if M=2 we get knapsack problem, and how to solve it faster than N*sum(A[i])? or your solution uses fact that a B[]s are approximately equal? |
What is bound for K? | Partisan | 1144. The Emperor's Riddle | 19 июн 2009 17:13 | 1 |
>>There are no bounds for K. What can they be? Sorry, the answer is in condition. Edited by author 19.06.2009 17:25 |
AC at long last =) | Burunduk1 | 1144. The Emperor's Riddle | 14 сен 2008 02:24 | 1 |
But I'm wonder, how so many people have got AC in 0.1 seconds and less... If you could give me your fast solutions, please, send it to sk1@hotbox.ru |
Could a general get nothing? | Cheryl | 1144. The Emperor's Riddle | 19 июн 2006 18:34 | 1 |
|
K's meaning | Huang WenHao | 1144. The Emperor's Riddle | 19 ноя 2010 21:38 | 3 |
K means, you need to find a answer <= k, it is not necessary for you to find the min answer. Then, what is the answer for this test 2 2 1 100 200 ? Edited by author 23.10.2006 12:24 I think that imperator was not so bad to formulate unsolvable problem before girls. His bound K was established kindly acording with opportunities of two girls and young programmers. So good greedy must work. |
People, give me some hint, please, please, please !!!!!! | ILTK! | 1144. The Emperor's Riddle | 15 авг 2005 22:51 | 1 |
|
Stupid Problem | ILTK! | 1144. The Emperor's Riddle | 28 июл 2005 19:11 | 1 |
What is a stupid problem ! Must we think out super heuristic to got ac? What is purpose of putting NP problems ? |
Can anyone give me the solution that's DP? | plg | 1144. The Emperor's Riddle | 14 июн 2003 18:33 | 1 |
Please mail to snow_whiteiq@yahoo.com |
Does this problem has a deterministic polynomial solution? If such solution exists, can anybody send it to me (ioi@list.ru) | Antonina Baskova | 1144. The Emperor's Riddle | 2 дек 2002 15:49 | 3 |
I can't understand how the solution can be greedy :). If we take M = 2, we'll get problem about stones and two piles, which is NP-hard. Maybe I misunderstood the problem? And I can realize WHAT IS K :) |
And once again: What means K? | GhostII | 1144. The Emperor's Riddle | 12 ноя 2002 22:10 | 1 |
"K is the maximum result that the emperor accepts." What result? Is it a maximum difference between the reachest general and the poorest general? But why it have been entered? As hint? I think, it plays an essential role for the decision of a problem... |
What is k?????? | King Without Kingdom | 1144. The Emperor's Riddle | 12 авг 2002 17:10 | 3 |
"K is the maximum result that the emperor accepts. " What result? Is it a maximum difference between the reachest general and the poorest general? |
Someone could help me :| with this problem...(+) | Miguel Angel | 1144. The Emperor's Riddle | 18 июн 2002 08:00 | 1 |
Email: miguelangelhdz@hotmail.com thanks :) |
If you can solve it please help me. | Pitchaya | 1144. The Emperor's Riddle | 22 май 2002 19:13 | 1 |
I try to solve it for a month but I can't see any solution so If you have solution please tell me. pitchayasit@hotmail.com Thank you. |
It's greedy algorithm ok??, i don't think so, but DP??!?, nor...Some help me,i'm lossing my mind!!!! | Miguel Angel | 1144. The Emperor's Riddle | 28 мар 2002 12:19 | 1 |
mail:miguelangelhdz@hotmail.com |
What is K? | Mephistos | 1144. The Emperor's Riddle | 22 мар 2002 14:40 | 1 |
Is it needed, and if it is, what is max value? |