library/util/ForAllPareto.hpp
Depends on
Code
template <typename F>
void for_all_pareto(const std::vector<int> &v, const F &f) {
int n = v.size();
std::vector<int> a(n, 0);
while (true) {
f(a);
int idx = 0;
while (idx < n and a[idx] == v[idx])
a[idx++] = 0;
if (idx == n)
break;
a[idx]++;
}
}
#line 1 "library/util/ForAllPareto.hpp"
template <typename F>
void for_all_pareto(const std::vector<int> &v, const F &f) {
int n = v.size();
std::vector<int> a(n, 0);
while (true) {
f(a);
int idx = 0;
while (idx < n and a[idx] == v[idx])
a[idx++] = 0;
if (idx == n)
break;
a[idx]++;
}
}
Back to top page