kyopro-lib

This documentation is automatically generated by online-judge-tools/verification-helper

View on GitHub

:warning: Enumerate subsets (Between)
(Mylib/Bit/enumerate_subsets_between.cpp)

Operations

Requirements

Notes

Problems

References

Code

#pragma once

namespace haar_lib {
  template <typename Func>
  void enumerate_subsets_between(int a, int b, const Func &f) {
    const int x = b ^ (a & b);
    for (int t = x;; t = (t - 1) & x) {
      if (not f(t | a)) break;
      if (t == 0) break;
    }
  }
}  // namespace haar_lib
#line 2 "Mylib/Bit/enumerate_subsets_between.cpp"

namespace haar_lib {
  template <typename Func>
  void enumerate_subsets_between(int a, int b, const Func &f) {
    const int x = b ^ (a & b);
    for (int t = x;; t = (t - 1) & x) {
      if (not f(t | a)) break;
      if (t == 0) break;
    }
  }
}  // namespace haar_lib
Back to top page