-
Notifications
You must be signed in to change notification settings - Fork 0
/
10919 - Prerequisites.cpp
127 lines (99 loc) · 2.85 KB
/
10919 - Prerequisites.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/**********************************************************************
* BISMILLAHIR RAHMANIR RAHIM *
* *
* "There's a benefit to losing, you get to learn from your mistakes" *
* *
* UVa: 10919 - Prerequisites? *
**********************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define chr getchar()
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define ps(ch) printf("%s",ch)
#define pc(ch) printf("%c",ch)
#define sf scanf
#define pf printf
#define pcs(x,y) printf("Case %d: %s", x, y)
#define pci(x,y) printf("Case %d: %d", x, y)
#define NL printf("\n")
#define nl '\n'
#define debug(x) printf("Debug %d !!\n",x)
#define mod 1000000007
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define FOR(i,j,k) for(i = j; i < k; i++)
#define rep(l,n) FOR(l,0,n)
#define REV(i,j,k) for(i = j; i > k; i--)
#define PI acos(-1.0)
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define pb(x) push_back(x)
#define ppb() pop_back()
#define sz(x) x.size()
#define xx first
#define yy second
#define mp(a,b) make_pair(a,b)
#define mem(ara,val) memset(ara,val,sizeof(ara))
#define clr(ara) mem(ara,0)
#define st(ara) mem(ara,-1)
#define all(a) a.begin(),a.end()
#define ssz(a) strlen(a)
#define eps 1e-9
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef vector< PII > VII;
//#define CFw
const int siz = 2000000 + 10;
int main(){
//std::ios_base::sync_with_stdio(0);
#ifdef CFw
while(1){
#endif
//FI;//FO;
int t, z = 0, l, i, len;
int k, m, c, r;
map<int,bool> mp;
while(si(k) && k){
mp.clear();
si(m);
int x;
rep(l,k){
si(x);
mp[x] = 1;
}
bool f = 1;
rep(l,m){
z = 0;
sii(c,r);
while(c--){
si(x);
if(mp[x])
z++;
}
if(z < r){
f = 0;
}
}
if(f)
puts("yes");
else
puts("no");
}
#ifdef CFw
NL;
}
#endif
return 0;
}