46492023-03-30 14:13:40hackemonHálózati biztonság (50)cpp17Accepted 50/50155ms17824 KiB
#include <bits/stdc++.h>
using namespace std;


vector<vector<int>> l(100005);
vector<int> ki(100005,0);
vector<bool> rossz(100005, 0);
int main() {
    int n, m, k;
    cin >> n >> m >> k;
    
    for(int i = 1;i<=m;i++ ) {
        int a, b;
        cin >> a >> b;
        l[a].push_back(b);
        l[b].push_back(a);
        ki[a]++;
        ki[b]++;
    }
    queue<int> rosszpontok;

    for(int i = 1;i<=n;i++ ) {
        if(ki[i] < k) {
            rosszpontok.push(i);
            rossz[i] = 1;
        }
    }
    while(!rosszpontok.empty()) {
        int x = rosszpontok.front();
        rosszpontok.pop();
        for(int i : l[x]) {
            if(ki[i] - 1 < k && !rossz[i]) {
                rosszpontok.push(i);
                rossz[i] = 1;
            } else {
                ki[i]--;
            }
        }
    }
    vector<int> pontok;
    for(int i = 1;i <= n;i++ ) {
        if(!rossz[i]) pontok.push_back(i);
    }
    cout << pontok.size() << endl;
    for(int i : pontok) cout << i << ' ';
    cout << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/04ms7260 KiB
2Accepted0/085ms12004 KiB
3Accepted2/24ms7944 KiB
4Accepted2/24ms8104 KiB
5Accepted2/24ms8196 KiB
6Accepted2/24ms8392 KiB
7Accepted2/24ms8696 KiB
8Accepted2/24ms8904 KiB
9Accepted2/24ms8992 KiB
10Accepted2/29ms9112 KiB
11Accepted2/24ms8884 KiB
12Accepted2/28ms9024 KiB
13Accepted3/34ms9024 KiB
14Accepted3/38ms9280 KiB
15Accepted3/310ms9736 KiB
16Accepted3/381ms12984 KiB
17Accepted3/39ms9536 KiB
18Accepted3/313ms10376 KiB
19Accepted3/390ms15880 KiB
20Accepted3/3155ms17824 KiB
21Accepted3/3101ms16448 KiB
22Accepted3/34ms9732 KiB