|
|
вернуться в форумstd::prev_permutation Послано Lomir 30 июн 2007 01:55 http://www.cplusplus.com/reference/algorithm/prev_permutation.html"If the function can determine the previous smaller permutation, it rearranges the elements as such and returns true. If that was not possible (because it is already at the smallest), it rearranges the elements according to the last permutation (sorted in descending order) and returns false." On Timus std::prev_permutation function doesn't return false ever. This code gets TLE: std::vector<int> v(5); for (int i = 0; i < 2; ++i) v[i] = 1; while (std::prev_permutation(v.begin(), v.end())); |
|
|