summaryrefslogtreecommitdiffstats
path: root/05-advanced_algorithms_and_complexity/03-np-completness/02-cleaning_apartment
diff options
context:
space:
mode:
Diffstat (limited to '05-advanced_algorithms_and_complexity/03-np-completness/02-cleaning_apartment')
-rw-r--r--05-advanced_algorithms_and_complexity/03-np-completness/02-cleaning_apartment/cleaning_apartment.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/05-advanced_algorithms_and_complexity/03-np-completness/02-cleaning_apartment/cleaning_apartment.cpp b/05-advanced_algorithms_and_complexity/03-np-completness/02-cleaning_apartment/cleaning_apartment.cpp
new file mode 100644
index 0000000..5690be7
--- /dev/null
+++ b/05-advanced_algorithms_and_complexity/03-np-completness/02-cleaning_apartment/cleaning_apartment.cpp
@@ -0,0 +1,42 @@
+#include <bits/stdc++.h>
+using namespace std;
+
+struct Edge {
+ int from;
+ int to;
+};
+
+struct ConvertHampathToSat {
+ int numVertices;
+ vector<Edge> edges;
+
+ ConvertHampathToSat(int n, int m) :
+ numVertices(n),
+ edges(m)
+ { }
+
+ void printEquisatisfiableSatFormula() {
+ // This solution prints a simple satisfiable formula
+ // and passes about half of the tests.
+ // Change this function to solve the problem.
+ cout << "3 2" << endl;
+ cout << "1 2 0" << endl;
+ cout << "-1 -2 0" << endl;
+ cout << "1 -2 0" << endl;
+ }
+};
+
+int main() {
+ ios::sync_with_stdio(false);
+
+ int n, m;
+ cin >> n >> m;
+ ConvertHampathToSat converter(n, m);
+ for (int i = 0; i < m; ++i) {
+ cin >> converter.edges[i].from >> converter.edges[i].to;
+ }
+
+ converter.printEquisatisfiableSatFormula();
+
+ return 0;
+}