-
Notifications
You must be signed in to change notification settings - Fork 0
/
1072_Startstudy.cpp
63 lines (59 loc) · 1.18 KB
/
1072_Startstudy.cpp
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
60
61
62
63
#include<iostream>
#include<string>
#include<vector>
using namespace std;
typedef struct Stu
{
string name;
vector<int> things;
}Student;
int main()
{
int count=0,countpeople=0;
int peoplenum,thingnum;
cin>>peoplenum>>thingnum;
int limit[thingnum];
for(int i=0;i<thingnum;i++)
{
cin>>limit[i];
}
vector<Student> det;
Student tmp;
int tmp_num;
int tmp_tmp;
bool flag=false;
for(int i=0;i<peoplenum;i++)
{
flag=false;
tmp.things.clear();
cin>>tmp.name>>tmp_num;
for(int j=0;j<tmp_num;j++)
{
cin>>tmp_tmp;
for(int k=0;k<thingnum;k++)
{
if(limit[k]==tmp_tmp)
{
flag=true;
tmp.things.push_back(tmp_tmp);
}
}
}
if(flag==true)
{
det.push_back(tmp);
}
}
for(int i=0;i<det.size();i++)
{
cout<<det[i].name<<":";
for(auto x: det[i].things)
{
cout<<" "<<x;
count++;
}
countpeople++;
cout<<endl;
}
cout<<countpeople<<" "<<count;
}