|
|
вернуться в форумSo easy. Don't spend your time searching a fast algorithm. Simple recursive solution which searchs all possible answers gets AC 0.015!! Re: So easy. Послано Alexey 18 июн 2006 00:23 Yeah, but I have TLE#7! Re: So easy. 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 Re: So easy. 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 |
|
|