ACM_Notebook_new

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

View the Project on GitHub ngthanhtrung23/ACM_Notebook_new

:warning: DataStructure/misc/offset_vector.h

Code

template<typename V>
struct OffsetVector {
    // Index should be in [minIndex, maxIndex].
    // minIndex and maxIndex can be negative.
    OffsetVector(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:
    std::vector<V> x;
    int offset;
};
#line 1 "DataStructure/misc/offset_vector.h"
template<typename V>
struct OffsetVector {
    // Index should be in [minIndex, maxIndex].
    // minIndex and maxIndex can be negative.
    OffsetVector(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:
    std::vector<V> x;
    int offset;
};
Back to top page