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
/* | |
we either win, or we learn. | |
*/ | |
#include <bits/stdc++.h> | |
#define HS ios_base::sync_with_stdio(false);cin.tie(NULL); | |
#define ll long long | |
#define pll pair<ll,ll> | |
#define pb push_back | |
#define M 100'000'0007 | |
#define lc '\n' |
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
/* | |
we either win, or we learn. | |
*/ | |
#include <bits/stdc++.h> | |
#define HS ios_base::sync_with_stdio(false);cin.tie(NULL); | |
#define ll long long | |
#define pll pair<ll,ll> | |
#define pb push_back | |
#define M 100'000'0007 | |
#define lc '\n' |
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
/* | |
we either win, or we learn. | |
*/ | |
#include <bits/stdc++.h> | |
#define HS ios_base::sync_with_stdio(false);cin.tie(NULL); | |
#define ll long long | |
#define pll pair<ll,ll> | |
#define pb push_back | |
#define M 100'000'0007 | |
#define lc '\n' |
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
/* | |
we either win, or we learn. | |
*/ | |
#include <bits/stdc++.h> | |
#define HS ios_base::sync_with_stdio(false);cin.tie(NULL); | |
#define ll long long | |
#define pll pair<ll,ll> | |
#define pb push_back | |
#define M 100'000'0007 | |
#define lc '\n' |
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
>> Binary exponentiation | |
>>> Resources: | |
T-1: https://cp-algorithms.com/algebra/binary-exp.html | |
>>> Implementation: | |
ll be(ll a,ll b) | |
{ |
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
>> BIT aka Fenwick tree. | |
>>> Resources: | |
Tutorial no.1: https://cp-algorithms.com/data_structures/fenwick.html | |
Tutorial no.2: https://www.youtube.com/watch?v=CWDQJGaN1gY | |
Visualization: https://visualgo.net/bn/fenwicktree?slide=1 | |
>>> Implementation: | |
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
>> DSU | |
>>> Resources: | |
Tutorial: https://cp-algorithms.com/data_structures/disjoint_set_union.html | |
Visualization: https://visualgo.net/en/ufds?slide=1 | |
>>> Implementation: | |
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
>> ETF | |
>>> Resources: | |
T-1: https://cp-algorithms.com/algebra/phi-function.html | |
T-2: https://www.geeksforgeeks.org/eulers-totient-function/ | |
>>> Implementation: |
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
>> Floyd Warshall | |
>>> Reources: | |
T-1: https://www.geeksforgeeks.org/floyd-warshall-algorithm-dp-16/ | |
T-2: https://www.youtube.com/watch?v=oNI0rf2P9gE | |
T-3: https://cp-algorithms.com/graph/all-pair-shortest-path-floyd-warshall.html | |
>>> Implementation: |
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
>> KMP (String pattern searching) | |
>>> Resources: | |
1 : https://www.topcoder.com/community/competitive-programming/tutorials/introduction-to-string-searching-algorithms/ | |
2 : https://www.geeksforgeeks.org/kmp-algorithm-for-pattern-searching/ | |
>>> Implementation: | |
void prearr(string s1,ll *lps) |
OlderNewer