|
|
back to boardShow all messages Hide all messagesSo easy. Ayhan Aliyev [BOTL] 9 Feb 2006 22:51 Don't spend your time searching a fast algorithm. Simple recursive solution which searchs all possible answers gets AC 0.015!! Firstly I made a table that shows which team can't participate with which one and then used recursion to compute answers. Note that order of teams does not matter. Choosing teams numbered 2,3 is same as choosing 3, 2 so try to choose teams in increasing odrer. I hope that it will help you I'd simply bruteforced it and used DP approach. AC in 0.156 sec on worst test. There are only 18 teams, so we can iterate over all possible 2^18 combinations and store "useful information" from previous iterations in large array. All done with bitmasks |
|
|