89682024-02-09 16:12:25zeytonxHálózati biztonság (50)cpp17Runtime error 25/50172ms26612 KiB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define endl "\n"
#define pll pair<ll,ll>
#define vll vector<ll>
#define mll map<ll,ll>
#define fs first
#define sc second

const ll MOD = 1e9+7;

void solve()
{
	ll n, m, k;
	cin >> n >> m >> k;
	vector<vector<ll>> g(n);
	for(ll i = 0; i < m; i++)
	{
		ll a, b;
		cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	set<ll> ans;
	for(ll i = 0; i < n; i++)
		if(g[i].size() >= k)
			ans.insert(i);
	
	for(ll i : ans)
	{
		ll ok = 0;
		for(ll j = 0; j < g[i].size(); j++)
			if(count(ans.begin(), ans.end(), g[i][j]))
				ok++;
		if(ok < k)
			ans.erase(i);
	}

	cout << ans.size() << endl;
	for(ll i : ans)
		cout << i+1 << " ";
	cout << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--)
        solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base25/50
1Accepted0/03ms2088 KiB
2Accepted0/043ms11748 KiB
3Runtime error0/23ms3444 KiB
4Runtime error0/23ms3692 KiB
5Accepted2/23ms3676 KiB
6Runtime error0/23ms3900 KiB
7Accepted2/23ms4000 KiB
8Runtime error0/23ms4204 KiB
9Runtime error0/23ms4192 KiB
10Accepted2/2172ms5172 KiB
11Accepted2/24ms4724 KiB
12Accepted2/29ms5120 KiB
13Accepted3/33ms5048 KiB
14Accepted3/34ms5816 KiB
15Accepted3/36ms6740 KiB
16Runtime error0/339ms13976 KiB
17Runtime error0/34ms7720 KiB
18Accepted3/312ms10180 KiB
19Runtime error0/341ms19976 KiB
20Runtime error0/372ms26612 KiB
21Runtime error0/364ms24140 KiB
22Accepted3/33ms11892 KiB