algo

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

View the Project on GitHub dnx04/algo

:warning: misc/offset_vector.hpp

Code

template <typename V>
struct offset_vector {
  // Index should be in [minIndex, maxIndex].
  // minIndex and maxIndex can be negative.
  offset_Vector(int minIndex, int maxIndex) {
    x.resize(maxIndex - minIndex + 1);
    offset = minIndex;
  }

  V& operator[](int index) { return x[index - offset]; }

  auto begin() { return x.begin(); }
  auto end() { return x.end(); }
  auto size() { return x.size(); }

 private:
  vector<V> x;
  int offset;
};
#line 1 "misc/offset_vector.hpp"
template <typename V>
struct offset_vector {
  // Index should be in [minIndex, maxIndex].
  // minIndex and maxIndex can be negative.
  offset_Vector(int minIndex, int maxIndex) {
    x.resize(maxIndex - minIndex + 1);
    offset = minIndex;
  }

  V& operator[](int index) { return x[index - offset]; }

  auto begin() { return x.begin(); }
  auto end() { return x.end(); }
  auto size() { return x.size(); }

 private:
  vector<V> x;
  int offset;
};
Back to top page