fork(3) download
  1. #include <list>
  2. #include <vector>
  3.  
  4. class Graph {
  5. int vertex_count;
  6. std::list<int> *adj;
  7. public:
  8. Graph(int vertex_count) {
  9. this->vertex_count = vertex_count;
  10. adj = new std::list<int>[vertex_count];
  11. }
  12. void addEdge(int v, int w) {
  13. adj[v].push_back(w);
  14. adj[w].push_back(v);
  15. }
  16. std::vector<bool> get_vertex_cover() {
  17. std::vector<bool> visited(vertex_count, false);
  18. for (int u = 0; u < vertex_count; u++) {
  19. if (visited[u]) continue;
  20. for (int v : adj[u]) {
  21. if (visited[v]) continue;
  22. visited[v] = visited[u] = true;
  23. break;
  24. }
  25. }
  26. return visited;
  27. }
  28. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i586-linux-gnu/4.9/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty