ShahjalalShohag / code-library

Templates, algorithms and data structures implemented and collected for programming contests.
MIT License
2.93k stars 776 forks source link

issue: Uninitialized variable: `ty` in `Graph Theory/Maximum Independant Set.cpp` file - line 74 #10

Closed LuchoBazz closed 2 years ago

LuchoBazz commented 2 years ago

Link issue

for (int i = 1; i <= n + 1; i++) {
    int ty; // Uninitialized variable: ty - when i is equal to n+1
    if (i <= n) cin >> ty;
    if (ty == 1 || i > n) {
      for (auto x : se) for (auto y : se) g[x - 1][y - 1] = 1, g[y - 1][x - 1] = 1;
      se.clear();
    } else {
      string s;
      cin >> s;
      if (mp.find(s) == mp.end()) {
        mp[s];
        mp[s] = mp.size();
      }
      int p = mp[s];
      se.insert(p);
    }
  }