-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1148.cpp
More file actions
57 lines (56 loc) · 986 Bytes
/
Copy path1148.cpp
File metadata and controls
57 lines (56 loc) · 986 Bytes
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
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
using namespace std;
#define size1 100000
#define size2 100
int N;
int Path[size1][size2];
int Node[size1];
int S, D;
void initcase(){
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++) Path[i][j] = 0;
}
int n;
int Searchindex(int val)
{
for (int i = 0; i < N; i++)if (Node[i] == val)
return i;
Node[n++] = val;
return n-1;
}
void readcase()
{
int x, y, noc;
int index1, index2;
cin >> N; //no of comrade
initcase();
n = 0;
for (int i = 0; i < N; i++)
{
cin >> x;
index1 = Searchindex(x);
cin >> noc;
for (int j = 0; j < noc; j++)
{
cin >> y;
index2 = Searchindex(y);
Path[index1][index2] = 1;
}
}
cin >> S >> D;
}
void printcase(){
cout << S << D<<endl;
for (int i = 0; i < N; i++)cout << Node[i]<<" ";
}
int main()
{
freopen("input.txt", "r", stdin);
int t;
while (cin >> t){
readcase();
printcase();
}
}