kyopro-lib

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

View on GitHub

:heavy_check_mark: Merge technique
(Mylib/Misc/merge_technique.cpp)

Operations

Requirements

Notes

Problems

References

Verified with

Code

#pragma once
#include <set>
#include <utility>

namespace haar_lib {
  template <typename T>
  void merge_technique(std::set<T> &res, std::set<T> &a, std::set<T> &b) {
    if (a.size() > b.size()) {
      a.insert(b.begin(), b.end());
      std::swap(res, a);
    } else {
      b.insert(a.begin(), a.end());
      std::swap(res, b);
    }
  }
}  // namespace haar_lib
#line 2 "Mylib/Misc/merge_technique.cpp"
#include <set>
#include <utility>

namespace haar_lib {
  template <typename T>
  void merge_technique(std::set<T> &res, std::set<T> &a, std::set<T> &b) {
    if (a.size() > b.size()) {
      a.insert(b.begin(), b.end());
      std::swap(res, a);
    } else {
      b.insert(a.begin(), a.end());
      std::swap(res, b);
    }
  }
}  // namespace haar_lib
Back to top page