library

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

View the Project on GitHub beet-aizu/library

:heavy_check_mark: vector/runlength.cpp

Verified with

Code

#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#endif

//BEGIN CUT HERE
template<typename T>
decltype(auto) runlength(vector<T> vs){
  vector<pair<T, int>> es;
  for(auto v:vs){
    if(es.empty() or es.back().first!=v)
      es.emplace_back(v,0);
    es.back().second++;
  }
  return es;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif
#line 1 "vector/runlength.cpp"

#include <bits/stdc++.h>
using namespace std;
#endif

//BEGIN CUT HERE
template<typename T>
decltype(auto) runlength(vector<T> vs){
  vector<pair<T, int>> es;
  for(auto v:vs){
    if(es.empty() or es.back().first!=v)
      es.emplace_back(v,0);
    es.back().second++;
  }
  return es;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif
Back to top page