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 1167. Bicolored Horses

CAN ANYONE TELL ME TEST#2?? GREEDY STRATEGY
Posted by Ashwin Kumar 30 Dec 2013 14:38
I am using greedy strategy
coeff = (unhappiness - possible reduced unhappiness)*length of line
x is position to cut the line for min unhappiness
:::::
add main list to priority queue with initial unhappiness
while(cuts<K){
remove List with max coeff;
cut in 2 parts for min unhappiness, calc coeff (for each list);
add the 2 parts of list to queue;
cuts++;

}
then poll all queue members(i.e. all cut lines) and add their unhappiness

I'm getting all posted tests right.. I tried all variations I could, and I'm getting right answers, but I am getting WA#2, please help!!!!


Edited by author 30.12.2013 21:16