Skip to content

Instantly share code, notes, and snippets.

View animeshf's full-sized avatar

Animesh Fatehpuria animeshf

  • Taipei, Taiwan
View GitHub Profile
#include "bits/stdc++.h"
using namespace std;
const int N = 5000;
const int T = 1000000;
const int V = 1000000000;
int n, t;
int arr[N + 1], hashMap[T + 1];
#include "bits/stdc++.h"
using namespace std;
const int N = 200000 + 50;
const int LN = 32;
int cur, lc[N * LN], rc[N * LN], leaves[N * LN];
inline void update(int node, int i, int val, int add){
leaves[node] += add;
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
const int INF = 1000000000;
const int LN = 20;
int P[MAX], DP[MAX][LN], VAL[MAX], MN[MAX], F[MAX], N, Q;
vector < int > adjList[MAX];
int root = 0, cur_time = 0;
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
const int INF = 1000000000;
const int LN = 20;
int P[MAX], DP[MAX][LN], VAL[MAX], MN[MAX], F[MAX], N, Q;
vector < int > adjList[MAX];
int root = 0, cur_time = 0;
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
const int INF = 1000000000;
const int LN = 20;
int P[MAX], DP[MAX][LN], VAL[MAX], MN[MAX], F[MAX], N, Q;
vector < int > adjList[MAX];
int root = 0, cur_time = 0;
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
const int INF = 1000000000;
const int LN = 20;
int P[MAX], DP[MAX][LN], VAL[MAX], MN[MAX], F[MAX], N, Q;
vector < int > adjList[MAX];
int root = 0, cur_time = 0;
// Mo's Algo on Tree
// Animesh Fatehpuria
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 40005;
const int MAXM = 100005;
const int LN = 19;