Skip to content

Instantly share code, notes, and snippets.

#include"segment_tree.cpp"
#include"map"
#include"algorithm"
#include"stdio.h"
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
struct query{char op[2]; int x;};
struct node{
int num_active_leaves;
void merge(node& a, node& b){
@utkarshl
utkarshl / LCA.cpp
Last active December 23, 2015 06:09
My library
#include"cassert"
#include"vector"
typedef unsigned int I32;
typedef I32* P32;
template <typename T, int beginidx=0> // in case vertices of graph are like 1, 2, 3 ..., beginidx becomes 1
class LCA {
P32 height, pathno, head, ancestor, log;
std::vector<I32>* paths;
const I32 ulim, root;
const T* const G;