89792024-02-09 16:28:05zeytonxHálózati biztonság (50)cpp17Wrong answer 43/50365ms19764 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, ans2;
	for(ll i = 0; i < n; i++)
		if(g[i].size() >= k)
			ans.insert(i);
	ans2 = ans;
	for(ll i : ans)
	{
		if(!count(ans2.begin(), ans2.end(), i))
			continue;
		ll ok = 0;
		for(ll j = 0; j < g[i].size(); j++)
			if(count(ans2.begin(), ans2.end(), g[i][j]))
				ok++;
		if(ok < k)
			ans2.erase(i);
	}

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

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
base43/50
1Accepted0/03ms1824 KiB
2Accepted0/043ms10428 KiB
3Accepted2/23ms2324 KiB
4Wrong answer0/23ms2496 KiB
5Accepted2/23ms2708 KiB
6Wrong answer0/23ms2852 KiB
7Accepted2/23ms2868 KiB
8Accepted2/23ms3132 KiB
9Accepted2/23ms3452 KiB
10Accepted2/2180ms4028 KiB
11Accepted2/24ms3368 KiB
12Accepted2/29ms3908 KiB
13Accepted3/33ms3744 KiB
14Accepted3/34ms4448 KiB
15Accepted3/36ms5360 KiB
16Time limit exceeded0/3365ms7220 KiB
17Accepted3/34ms5152 KiB
18Accepted3/312ms7156 KiB
19Accepted3/345ms15608 KiB
20Accepted3/375ms19764 KiB
21Accepted3/368ms16128 KiB
22Accepted3/33ms4416 KiB