49752023-04-08 01:33:05TomaSajtHálózati biztonság (50)cpp17Accepted 50/50254ms49136 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<set<int>> g(n + 1);
  while (m--) {
    int u, v;
    cin >> u >> v;
    g[u].insert(v);
    g[v].insert(u);
  }
  queue<int> bad;
  for (int i = 1; i <= n; i++) {
    if (g[i].size() < k)
      bad.push(i);
  }
  while (!bad.empty()) {
    int u = bad.front();
    bad.pop();
    for (int v : g[u]) {
      g[v].erase(u);
      if (g[v].size() < k)
        bad.push(v);
    }
  }
  vector<int> res;
  for (int i = 1; i <= n; i++) {
    if (g[i].size() >= k)
      res.push_back(i);
  }
  cout << res.size() << '\n';
  for (auto &u : res)
    cout << u << ' ';
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1828 KiB
2Accepted0/0130ms26792 KiB
3Accepted2/23ms2236 KiB
4Accepted2/23ms2452 KiB
5Accepted2/23ms2824 KiB
6Accepted2/22ms2748 KiB
7Accepted2/23ms3020 KiB
8Accepted2/23ms3272 KiB
9Accepted2/23ms3448 KiB
10Accepted2/28ms5640 KiB
11Accepted2/23ms4088 KiB
12Accepted2/26ms4816 KiB
13Accepted3/33ms3928 KiB
14Accepted3/36ms5676 KiB
15Accepted3/37ms7104 KiB
16Accepted3/3254ms28988 KiB
17Accepted3/37ms5768 KiB
18Accepted3/39ms11112 KiB
19Accepted3/396ms33288 KiB
20Accepted3/3240ms49136 KiB
21Accepted3/3107ms35496 KiB
22Accepted3/33ms4256 KiB