This file contains 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; | |
typedef long long ll; | |
class SegmentTree { | |
struct Node { | |
pair<ll, ll> range; | |
ll left = 0, right = 0, value = INT_MAX; | |
}; |
This file contains 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
// https://codeforces.com/problemset/problem/342/E | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef int ll; | |
const ll INF = 1e9; | |
class Tree { |
This file contains 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
// https://cses.fi/problemset/result/7855807/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
class BinaryLifting { | |
vector<vector<ll>> graph; | |
vector<vector<ll>> parent; |
This file contains 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; | |
typedef long long ll; | |
class MergeSortTreeImmutable { | |
struct Node { | |
vector<ll> v; | |
pair<ll, ll> range; | |
Node* left = nullptr; |
This file contains 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; | |
typedef long long ll; | |
class DSU { | |
vector<ll> p; // parent if positive, size if negative, parent of root is the size of component | |
stack<pair<ll, ll>> log; // keep track of p[i] value history, first is index, second is value | |
stack<ll> size; |
This file contains 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; | |
typedef long long ll; | |
class DFSTree { | |
vector<ll> nums, low; | |
vector<bool> deleted; | |
stack<ll> st; | |
vector<ll> scc; |
This file contains 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; | |
typedef int ll; | |
class SegmentTree { | |
struct Node { | |
pair<ll, ll> range; | |
ll left = 0, right = 0, value = 0; | |
}; |
This file contains 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
// https://cses.fi/problemset/task/1647 | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
class SparseTable { | |
private: | |
vector<vector<ll>> ST; |
This file contains 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
// https://cses.fi/problemset/task/2195/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
ll crossProd(pair<ll, ll> a, pair<ll, ll> b, pair<ll, ll> c) { | |
return (b.first - a.first) * (c.second - a.second) - (b.second - a.second) * (c.first - a.first); | |
} |
This file contains 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
// https://cses.fi/problemset/task/1688/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
class BinaryLifting { | |
ll MAXLOG; | |
vector<vector<ll>> parent; |
NewerOlder