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
FROM python:3.6 | |
WORKDIR /app | |
ADD . /app | |
RUN pip install -r requirements.txt | |
RUN python setup.py build_ext --inplace | |
ENTRYPOINT ["python"] | |
CMD ["app.py"] |
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
typedef vector<int> vi; | |
typedef vector<vi> vvi; | |
#define pb push_back | |
#define MAX 100005 | |
// C++ implementation of tarjan's algorithm for SCC | |
// foundat: analogous to time at which the vertex was discovered | |
// disc: will contain the foundat value of ith vertex(as in input graph) | |
// low: will contain the lowest vertex(foundat value) reachable from ith vertex(as in input graph) | |
// onstack: whether the vertex is on the stack st or not | |
// scc: will contain vectors of strongly connected vertices |
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
// In the name of Allah. | |
// We're nothing and you're everything. | |
// Ya Ali! | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
const int maxn = 1e2 + 14, lg = 15; |
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
/* Complexity: O(E + V) | |
Tarjan's algorithm for finding strongly connected | |
components. | |
*d[i] = Discovery time of node i. (Initialize to -1) | |
*low[i] = Lowest discovery time reachable from node | |
i. (Doesn't need to be initialized) | |
*scc[i] = Strongly connected component of node i. (Doesn't | |
need to be initialized) | |
*s = Stack used by the algorithm (Initialize to an empty |