Advertisement
TwITe

Untitled

Dec 2nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.15 KB | None | 0 0
  1. bool used[MAXN] {false};
  2. int color[MAXN];
  3. vector <vector <int>> v;
  4. bool flag = true;
  5. vector <bool> clr;
  6. int k;
  7.  
  8. void dfs(int node) {
  9.     used[node] = true;
  10.     //comp.push_back(node);
  11.     int clr[k];
  12.     for (auto to : v[node]) {
  13.         clr[to] = color[to];
  14.     }
  15.     for (auto to : v[node]) {
  16. //        if (!used[to]) {
  17. //            dfs(to);
  18. //        }
  19.         if (clr[to] == -1) {
  20.  
  21.         }
  22.     }
  23. }
  24.  
  25. void task3() {
  26.     int n, m;
  27.     cin >> n >> m >> k;
  28.     for (int i = 0; i < n; i++) {
  29.         cin >> color[i];
  30.     }
  31.     clr.resize(k);
  32.     v.resize(n);
  33.     for (int i = 0; i < m; i++) {
  34.         int a, b;
  35.         cin >> a >> b;
  36.         a--, b--;
  37.         v[a].push_back(b);
  38.         v[b].push_back(a);
  39.     }
  40.     for (int i = 0; i < n; i++) {
  41.         clr.clear();
  42.         dfs(i);
  43. //            int klr[k + 1];
  44. //            for (int i = 0; i < comp.size(); i++) {
  45. //                if (comp[i] == -1) {
  46. //
  47. //                }
  48. //            }
  49.     }
  50.     if (flag) {
  51.         cout << "YES";
  52.         for (int i = 0; i < n; i++) {
  53.             cout << color[i];
  54.         }
  55.     }
  56.     else {
  57.         cout << "NO";
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement