library

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

View the Project on GitHub sash2104/library

:warning: 座標圧縮
(util/compress.hpp)

Required by

Code

/**
 * @title 座標圧縮
 */
#pragma once
#include <algorithm>
#include <vector>

template< typename T >
struct Compress {
  std::vector< T > xs;

  Compress() = default;
  Compress(const std::vector< T > &vs) { add(vs); }
  Compress(const std::initializer_list< std::vector< T > > &vs) { for(const T &p : vs) add(p); }

  void add(const std::vector< T > &vs) { std::copy(std::begin(vs), std::end(vs), std::back_inserter(xs)); }
  void add(const T &x) { xs.emplace_back(x); }

  void build() {
    std::sort(std::begin(xs), std::end(xs));
    xs.erase(unique(std::begin(xs), std::end(xs)), std::end(xs));
  }

  std::vector< int > get(const std::vector< T > &vs) const {
    std::vector< int > ret;
    std::transform(std::begin(vs), std::end(vs), std::back_inserter(ret), [&](const T &x) {
      return std::lower_bound(std::begin(xs), std::end(xs), x) - std::begin(xs);
    });
    return ret;
  }

  int get(const T &x) const {
    return std::lower_bound(std::begin(xs), std::end(xs), x) - std::begin(xs);
  }

  const T &operator[](int k) const { return xs[k]; }
};
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
    bundler.update(path)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
    raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: util/compress.hpp: line 4: #pragma once found in a non-first line
Back to top page