This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |