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
// https://cses.fi/problemset/task/1688/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
const ll MAXLOG = 18; | |
void preCalc(vector<vector<ll>>& parent) { |
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
// https://cses.fi/problemset/task/1687/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
ll jump(vector<vector<ll>>& parent, ll x, ll k) { | |
for(ll i = 0; i <= 18; i++) { | |
if(k & (1 << i)) { |
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; | |
typedef long long ll; | |
#include <ext/pb_ds/assoc_container.hpp> | |
using namespace __gnu_pbds; | |
template <class T> | |
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; |
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
// https://cses.fi/problemset/task/1675/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
class DSU { | |
private: | |
vector<ll> v; |
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
// https://cses.fi/problemset/task/1753/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
const ll MOD = 1e9 + 7; | |
class rolling_hash { |
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; | |
typedef long long ll; | |
class trie { | |
private: | |
struct Node { | |
bool endOfWord = false; | |
map<char, Node*> children; |
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
// https://cses.fi/problemset/task/1648 | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
class SQRT { | |
private: | |
vector<ll> blocks, arr; |
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; | |
typedef long long ll; | |
class SegmentTree { | |
private: | |
struct Node { | |
Node* _left; | |
Node* _right; |
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; | |
typedef long long ll; | |
class SegmentTree { | |
private: | |
struct Node { | |
Node* _left; | |
Node* _right; |
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; | |
typedef long long ll; | |
class dfsTree { | |
private: | |
vector<vector<ll>> tree; | |
vector<ll> nums, tail, low, parent; | |
ll time = 1; |