Advertisement
Rock-Lee

A - lista 5...tentando muito

May 2nd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define MAXN 100010
  3.  
  4. using namespace std;
  5.  
  6. typedef long long int ll;
  7.  
  8. vector<int> euler, graph[MAXN];
  9. bitset<MAXN> vis;
  10.  
  11. struct Node {
  12.     ll colours;
  13.  
  14.     Node() {
  15.         this->colours = (1LL << 0);
  16.     }
  17.     void newNode(Node node1, Node node2) {
  18.         this->colours = node1 | node2 | colours;
  19.     }
  20.     int countColours(Node node) {
  21.         return __builtin_popcount(node.colours);
  22.     }
  23.  
  24.    
  25. };
  26.  
  27. void euler_tour(int node) {
  28.     vis[node] = 1;
  29.     euler.push_back(node);
  30.  
  31.     for(int i = 0; i < graph[node].size(); i++) {
  32.         int v = graph[node][i];
  33.         if(!vis[v]) euler_tour(v);
  34.     }
  35.  
  36.     euler.push_back(node);
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43. int main() {
  44.  
  45.  
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement