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