algorithm

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

View the Project on GitHub satashun/algorithm

:heavy_check_mark: cpp_src/utility/RectangleSum1D.hpp

Verified with

Code

template <class T>
V<T> cumsum(const V<T>& vec) {
    int n = vec.size();
    V<T> res(n + 1);
    rep(i, n) { res[i + 1] = res[i] + vec[i]; }
    return res;
}
#line 1 "cpp_src/utility/RectangleSum1D.hpp"
template <class T>
V<T> cumsum(const V<T>& vec) {
    int n = vec.size();
    V<T> res(n + 1);
    rep(i, n) { res[i + 1] = res[i] + vec[i]; }
    return res;
}
Back to top page