-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10919.cpp
49 lines (36 loc) · 937 Bytes
/
10919.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
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(int argc, char const *argv[])
{
int k, m, r, c, tmp, index, meet;
bool flag, course[10000];
while (1) {
scanf("%d", &k);
if (k < 1) break;
scanf("%d", &m);
for (int i = 0; i < 10000; ++i)
course[i] = false;
for (int i = 0; i < k; ++i) {
scanf("%d", &tmp);
course[tmp] = true;
}
flag = true;
for (int i = 0; i < m; ++i) {
scanf("%d %d", &c, &r);
meet = 0;
for (int j = 0; j < c; ++j) {
scanf("%d", &tmp);
if (!flag || meet == r) continue;
if (course[tmp]) meet++;
}
if (meet != r) flag = false;
}
if (flag)
printf("yes\n");
else
printf("no\n");
}
return 0;
}