-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe.cpp
More file actions
47 lines (46 loc) · 898 Bytes
/
Copy pathe.cpp
File metadata and controls
47 lines (46 loc) · 898 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
#include<iostream>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
int n,m;
cin>>n>>m;
int a[m][n];
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
a[i][j]=0;
}
}
for(int j=0;j<m;j++)
{
int len;
cin>>len;
int num;
for(int k=0;k<len;k++)
{
cin>>num;
a[j][num-1]=num;
}
}
int sum=0;
for(int i=0;i<n;i++)
{
int flag=0;
for(int j=0;j<m;j++)
{
if(a[j][i]==0)
{
flag=1;
}
}
if(flag==0)sum++;
}
cout<<sum<<endl;
}
return 0;
}