This documentation is automatically generated by online-judge-tools/verification-helper
#include "tools/runlength.hpp"#pragma once
#include "./base.hpp"
#include <type_traits>
#include <vector>
namespace matumoto {
template <typename Iterator>
auto runlength(Iterator first, Iterator last) {
vector<pair<remove_reference_t<decltype(*first)>, int>> res;
for (auto it = first; it != last; it++) {
if (res.empty() or res.back().first != *it)
res.emplace_back(*it, 0);
res.back().second++;
}
return res;
}
} // namespace matumoto#line 2 "tools/runlength.hpp"
#line 2 "tools/base.hpp"
namespace matumoto {
using namespace std;
}
#line 4 "tools/runlength.hpp"
#include <type_traits>
#include <vector>
namespace matumoto {
template <typename Iterator>
auto runlength(Iterator first, Iterator last) {
vector<pair<remove_reference_t<decltype(*first)>, int>> res;
for (auto it = first; it != last; it++) {
if (res.empty() or res.back().first != *it)
res.emplace_back(*it, 0);
res.back().second++;
}
return res;
}
} // namespace matumoto