diff options
Diffstat (limited to '03-algorithms_on_graphs/02-decomposition/01-acyclicity')
5 files changed, 37 insertions, 0 deletions
diff --git a/03-algorithms_on_graphs/02-decomposition/01-acyclicity/acyclicity.cpp b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/acyclicity.cpp new file mode 100644 index 0000000..9cd27e6 --- /dev/null +++ b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/acyclicity.cpp @@ -0,0 +1,22 @@ +#include <iostream> +#include <vector> + +using std::vector; +using std::pair; + +int acyclic(vector<vector<int> > &adj) { + //write your code here + return 0; +} + +int main() { + size_t n, m; + std::cin >> n >> m; + vector<vector<int> > adj(n, vector<int>()); + for (size_t i = 0; i < m; i++) { + int x, y; + std::cin >> x >> y; + adj[x - 1].push_back(y - 1); + } + std::cout << acyclic(adj); +} diff --git a/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/01 b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/01 new file mode 100644 index 0000000..010643f --- /dev/null +++ b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/01 @@ -0,0 +1,5 @@ +4 4 +1 2 +4 1 +2 3 +3 1 diff --git a/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/01.a b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/01.a new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/01.a @@ -0,0 +1 @@ +1 diff --git a/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/02 b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/02 new file mode 100644 index 0000000..a65b977 --- /dev/null +++ b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/02 @@ -0,0 +1,8 @@ +5 7 +1 2 +2 3 +1 3 +3 4 +1 4 +2 5 +3 5 diff --git a/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/02.a b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/02.a new file mode 100644 index 0000000..573541a --- /dev/null +++ b/03-algorithms_on_graphs/02-decomposition/01-acyclicity/tests/02.a @@ -0,0 +1 @@ +0 |