1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
using namespace std;
int main(int argc, char** argv) 
{
	int n, m, d;
	int q,p;
	int l_miast=0;

	cin >> n >> m >> d ;
	int ** droga = new int*[m];
	for (int i=0;i<m;i++)
	{
		droga[i] = new int [2];
		for (int o=0;o<2;o++)
			droga[i][o]=0;
	}
	bool *nalezy = new bool [n];
	int *miasto = new int [n];
	for (int i=0;i<n;i++)
		miasto[i] = 0;
	for (int i=0;i<m;i++)
	{
		cin >> q; cin >> p; droga[i][0] = q-1; droga[i][1] = p-1;
	}
		
	
	for (int i=0;i<m;i++)
	{
		for (int o=0;o<d;o++)
			miasto[droga[i][o]]++;
	}
	for (int i=0;i<n;i++)
	{
		if (miasto[i]>=d)
		{	nalezy[i] = true; l_miast++;}
		else 
			nalezy[i] = false;
	}
	if (l_miast>1)
	{
		cout << l_miast << endl;
		for (int i=0;i<m;i++)
		{
			if (nalezy[i]==true)
				cout <<i+1<<" ";
		}
		
	}
	else
		cout << "NIE";
	
	
	
	for (int i=0;i<m;i++)
		delete [] droga[i];
	delete [] nalezy;
	delete [] miasto;
	return 0;
}