89712024-02-09 16:19:51zeytonxHálózati biztonság (50)cpp17Wrong answer 41/50354ms19688 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, wa;
	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]) && !count(wa.begin(), wa.end(), g[i][j]))
				ok++;
		if(ok >= k)
			ans2.insert(i);
		else
		 	wa.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]) && !count(wa.begin(), wa.end(), g[i][j]))
				ok++;
		if(ok >= k)
			ans2.insert(i);
		else
		 	wa.insert(i);
	}

	cout << ans2.size() << endl;
	for(ll i : ans2)
		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
base41/50
1Accepted0/03ms1828 KiB
2Accepted0/046ms10400 KiB
3Accepted2/23ms2388 KiB
4Wrong answer0/23ms2500 KiB
5Accepted2/23ms2728 KiB
6Wrong answer0/23ms2816 KiB
7Accepted2/23ms2908 KiB
8Accepted2/23ms3180 KiB
9Accepted2/23ms3368 KiB
10Time limit exceeded0/2340ms4076 KiB
11Accepted2/24ms3776 KiB
12Accepted2/216ms4136 KiB
13Accepted3/33ms3980 KiB
14Accepted3/34ms4312 KiB
15Accepted3/36ms5216 KiB
16Time limit exceeded0/3354ms6752 KiB
17Accepted3/34ms4884 KiB
18Accepted3/318ms7024 KiB
19Accepted3/343ms15472 KiB
20Accepted3/374ms19688 KiB
21Accepted3/390ms16304 KiB
22Accepted3/33ms4400 KiB