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 1922. Superhero Team

If you have TL on test 3, read this
Posted by DR. Zhihua Lai 28 Dec 2012 07:27
The main loop is just O(n), not O(n^2)
you need to sort the heroes first according to their wishes.

the main loop is

for (int i = 1; i <= ulen; i ++)
{
    if (w[0].wish <= i)
    {
        used[0] = true;
        search(0, i, 1);
        used[0] = false;
    }
}


Edited by author 29.12.2012 01:28

Edited by author 29.12.2012 01:31