text
stringlengths 49
983k
|
|---|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 + 5;
int n, m;
int he[maxn];
bool cur[maxn];
int main() {
scanf("%d%d", &m, &n);
memset(cur, false, 103 * sizeof(bool));
for (int i = 1; i <= m; i++) {
int k, kk;
scanf("%d", &k);
for (int j = 1; j <= k; j++) {
scanf("%d", &kk);
cur[kk] += 1;
}
}
bool ss = 1;
for (int i = 1; i <= n; i++) {
if (cur[i] == 0) ss = 0;
}
if (ss) {
printf("Yes");
exit(0);
}
printf("No");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
int n, m, p, t;
bool vis[N];
int main() {
while (scanf("%d%d", &n, &m) == 2) {
memset(vis, 0, sizeof(vis));
bool flag = 1;
for (int i = 0; i < n; i++) {
scanf("%d", &p);
for (int i = 0; i < p; i++) {
scanf("%d", &t);
vis[t] = 1;
}
}
for (int i = 1; i <= m; i++)
if (!vis[i]) flag = 0;
if (flag)
puts("YES");
else
puts("NO");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
bool on[100];
int button, bulb;
cin >> button >> bulb;
int b;
int temp;
for (int i = 0; i < 100; i++) {
on[i] = false;
}
for (int i = 0; i < button; i++) {
cin >> b;
for (int i = 0; i < b; i++) {
cin >> temp;
on[temp - 1] = true;
}
}
int count = 0;
for (int i = 0; i < 100; i++) {
if (on[i] == 1) {
count++;
}
}
if (count == bulb) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, x, y, ct = 0;
cin >> n >> m;
bool b[105] = {false};
for (int i = 0; i < n; i++) {
cin >> x;
for (int j = 0; j < x; j++) {
cin >> y;
b[y] = true;
}
}
for (int i = 0; i < 105; i++) {
if (b[i] == true) {
ct++;
}
}
if (ct == m) {
cout << "YES";
} else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool a[105], b[105];
int main() {
int n, m, x, y;
cin >> n >> m;
bool w;
for (int i = 1; i <= n; i++) {
cin >> x;
a[x] = true;
while (x--) {
cin >> y;
b[y] = true;
}
for (int k = 1; k <= m; k++) {
if (b[k] == false) {
w = false;
break;
} else
w = true;
}
}
if (w)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> vec(m + 1, 0);
for (int i = 0; i < (n); ++i) {
int tot, num;
cin >> tot;
for (int j = 0; j < (tot); ++j) cin >> num, vec[num] = 1;
}
int sum = 0;
for (int i = 0; i < (m + 1); ++i) sum += vec[i];
if (sum < m)
cout << "No\n";
else
cout << "Yes\n";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, n, m, i, j, c, flag[1000];
for (i = 0; i < 1000; i++) flag[i] = 0;
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> c;
for (j = 0; j < c; j++) {
cin >> x;
flag[x] = 1;
}
}
for (i = 0; i < m; i++)
if (flag[i + 1] == 0) {
cout << "NO" << endl;
return 0;
}
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int used[105];
int main(int argc, char const* argv[]) {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i += 1) {
int x;
scanf("%d", &x);
for (int j = 0; j < x; j += 1) {
int a;
scanf("%d", &a);
used[a] = 1;
}
}
if (accumulate(used, used + m + 1, 0) == m)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n, i, j;
int tempa, tempb;
cin >> n >> m;
int a[m];
for (i = 0; i < m; i++) {
a[i] = 0;
}
for (i = 0; i < n; i++) {
cin >> tempa;
for (j = 0; j < tempa; j++) {
cin >> tempb;
a[tempb - 1]++;
}
}
bool result = true;
for (i = 0; i < m; i++) {
if (a[i] == 0) {
result = false;
break;
}
}
if (result) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a;
int index[200];
for (int i = 1; i <= m; i++) index[i] = 0;
for (int i = 0; i < n; i++) {
cin >> a;
int b;
for (int j = 0; j < a; j++) {
cin >> b;
index[b] = index[b] + 1;
}
}
for (int i = 1; i <= m; i++) {
if (index[i] == 0) {
cout << "NO";
exit(0);
}
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int main() {
int n, m;
cin >> n >> m;
vector<bool> v(m + 1, false);
for (int i = 0; i < n; i++) {
int x;
cin >> x;
while (x--) {
int y;
cin >> y;
v[y] = true;
}
}
bool ok = true;
for (int i = 1; i <= m; i++)
if (!v[i]) ok = false;
puts(ok ? "YES" : "NO");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[110] = {};
for (int i = 0; i < n; i++) {
int k;
cin >> k;
for (int j = 0; j < k; j++) {
int x;
cin >> x;
a[x - 1] = 1;
}
}
cout << (count(a, a + m, 1) == m ? "YES" : "NO");
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, m, q, x, cnt;
set<long long> st;
int main() {
ios_base::sync_with_stdio(0);
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> q;
for (int j = 0; j < q; j++) {
cin >> x;
st.insert(x);
}
}
if (st.size() == m)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
set<int> s;
for (int i = 0; i < n; ++i) {
int y;
cin >> y;
for (int j = 0; j < y; ++j) {
int a;
cin >> a;
s.insert(a);
}
}
if (s.size() == m) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m;
int x, k, check[1000], i;
int main() {
cin >> n >> m;
while (n--) {
cin >> k;
for (i = 1; i <= k; i++) {
cin >> x;
check[x] = 1;
}
}
for (i = 1; i <= m; i++)
if (check[i] == 0) {
cout << "NO";
return 0;
}
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
int numberOfTests = 1;
bool result;
int m;
int n;
vector<bool> lights;
void resetData() {
result = 0;
lights.clear();
}
void readInput() {
cin >> n >> m;
lights.resize(m + 2, false);
for (int i = 0; i < n; ++i) {
int k;
cin >> k;
for (int j = 0; j < k; ++j) {
int temp;
cin >> temp;
lights[temp] = true;
}
}
}
void computeResult() {
result = true;
for (int i = 1; i <= m; ++i) {
if (lights[i] == false) {
result = false;
break;
}
}
}
void printResult() { cout << (result ? "YES" : "NO") << endl; }
int main(int argc, char* argv[]) {
ios_base::sync_with_stdio(false);
if (argc > 1 && strcmp(argv[1], "LOCAL") == 0) {
freopen("CppInput.txt", "r", stdin);
cin >> numberOfTests;
}
for (int i = 0; i < numberOfTests; ++i) {
resetData();
readInput();
computeResult();
printResult();
}
return EXIT_SUCCESS;
}
|
#include <bits/stdc++.h>
using namespace std;
bool ans[100];
int main() {
int n, m, k, l;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> l;
for (int y = 0; y < m; y++) {
if (l == y + 1) ans[y] = true;
}
}
}
for (int i = 0; i < m; i++) {
if (ans[i] == false) {
cout << "NO";
return 0;
}
}
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, t, i, c = 0, d = 0, j;
cin >> n >> m;
int b[m];
for (i = 1; i <= m; i++) b[i] = i;
while (n--) {
cin >> t;
int a[t];
int i;
for (i = 0; i < t; i++) cin >> a[i];
for (i = 0; i < t; i++) {
for (j = 1; j <= m; j++) {
if (a[i] == b[j]) {
++c;
b[j] = 0;
}
}
}
}
if (c == m)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _f(const char* name, T&& arg) {
cout << name << ": " << arg << endl;
}
template <typename T, typename... Args>
void _f(const char* names, T&& arg, Args&&... args) {
const char* split = strchr(names + 1, ',');
cout.write(names, split - names) << ": " << arg << " |";
_f(split, args...);
}
int main(int argc, char** argv) {
std::ios_base::sync_with_stdio(false);
cin.tie(0);
cout.precision(5);
cout << fixed;
int n, m;
cin >> n >> m >> ws;
vector<int> aa(m + 1, 0);
for (int i = (0); i < (n); ++i) {
string a, b;
getline(cin, a);
istringstream iss(a);
int j = 0;
while (getline(iss, b, ' ')) {
if (j > 0) {
aa[stoi(b)] = 1;
}
++j;
}
}
bool ok = 1;
for (int i = (1); i < (m + 1); ++i) {
if (aa[i] == 0) {
ok = 0;
break;
}
}
cout << (ok ? "YES" : "NO") << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, x, a;
std::cin >> n >> n;
std::set<int> S;
for (; std::cin >> x;)
for (; x-- && std::cin >> a; S.insert(a))
;
std::cout << (S.size() < n ? "NO" : "YES");
}
|
#include <bits/stdc++.h>
using namespace std;
long long int ar[1000000];
int price[10000];
int price1[10000];
int ans[100000];
char asl[1000][1000];
int fac(int b) {
if (b == 1 || b == 0) return 1;
return fac(b - 1) * b;
}
int main() {
long long n, m, i, j, a, b, c, d, f, l, h, maxx;
string s, t, o;
char ch, ch1;
float p, y, x, u;
cin >> n >> m;
for (i = 1; i <= n; i++) {
cin >> a;
for (j = 0; j < a; j++) {
cin >> b;
ar[b] = 1;
}
}
d = 0;
for (i = 1; i <= m; i++) {
if (ar[i] == 0) {
d = 1;
break;
}
}
if (d == 1)
cout << "NO" << endl;
else
cout << "YES" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, cnt, x, sum = 0, t = 0;
int tt[1000];
cin >> n >> m;
int a[1000];
while (n--) {
cnt = 0;
cin >> x;
for (int i = 0; i < x; i++) {
cin >> a[i];
t = a[i];
tt[t] = 1;
}
for (t = 1; t <= m; t++) {
if (tt[t] == 1) {
cnt++;
}
}
}
if (cnt == m)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int b, l, k = 0, p, m;
cin >> b >> l;
int n[l];
for (int i = 0; i < l; i++) {
n[i] = 0;
}
for (int i = 0; i < b; i++) {
cin >> p;
for (int j = 0; j < p; j++) {
cin >> m;
n[m - 1]++;
}
}
for (int i = 0; i < l; i++) {
if (n[i] == 0) {
k++;
}
}
if (k > 0) {
cout << "NO";
} else {
cout << "YES";
}
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
bool was[N];
int main() {
srand(time(NULL));
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
int kol = 0;
cin >> kol;
for (int j = 1; j <= kol; j++) {
int x;
cin >> x;
was[x] = true;
}
}
for (int i = 1; i <= m; i++) {
if (!was[i]) cout << "NO", exit(0);
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
set<int> s;
int main() {
int n, m;
scanf("%d%d", &n, &m);
int d;
for (int i = 0; i < n; i++) {
scanf("%d", &d);
while (d--) {
int x;
scanf("%d", &x);
s.insert(x);
}
}
if (s.size() == m)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool arr[101];
int main() {
int n, m;
cin >> n >> m;
bool flag = true;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
for (int i = 0; i < x; i++) {
int y;
cin >> y;
arr[y - 1] = 1;
}
}
for (int i = 0; i < m; i++) {
if (!arr[i]) {
flag = false;
}
}
if (flag)
cout << "YES";
else {
cout << "NO";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T in() {
char ch;
T n = 0;
bool ng = false;
while (1) {
ch = getchar();
if (ch == '-') {
ng = true;
ch = getchar();
break;
}
if (ch >= '0' && ch <= '9') break;
}
while (1) {
n = n * 10 + (ch - '0');
ch = getchar();
if (ch < '0' || ch > '9') break;
}
return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
if (P == 0) return 1;
if (P & 1)
return B * POW(B, P - 1);
else
return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
if (a < 0) return Gcd(-a, b);
if (b < 0) return Gcd(a, -b);
return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
if (a < 0) return Lcm(-a, b);
if (b < 0) return Lcm(a, -b);
return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
long long ret = 1;
while (power) {
if (power & 1) ret = (ret * base) % MOD;
base = (base * base) % MOD;
power >>= 1;
}
return ret;
}
bool isVowel(char ch) {
ch = toupper(ch);
if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
return true;
return false;
}
long long ModInverse(long long number, long long MOD) {
return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
if (isalpha(ch) && !isVowel(ch)) return true;
return false;
}
int toInt(string s) {
int sm;
stringstream second(s);
second >> sm;
return sm;
}
int vis[400007];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
for (int j = 0; j < x; j++) {
int c;
cin >> c;
vis[c] = 1;
}
}
int f = 0;
for (int i = 1; i < m + 1; i++) {
if (!vis[i]) f++;
}
if (!f)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxm = 110;
int f[maxm];
int n, m;
int main() {
cin >> n >> m;
int ans = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
while (x--) {
int y;
cin >> y;
if (!f[y]) {
f[y] = 1;
ans++;
}
}
}
cout << ((ans == m) ? "YES" : "NO") << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n, t, x;
cin >> n >> m;
int ara[m + 1];
memset(ara, 0, sizeof(ara));
while (n--) {
cin >> t;
while (t--) {
cin >> x;
ara[x] = 1;
}
}
int temp = true;
for (int i = 1; i <= m; i++) {
if (ara[i] == 0) {
temp = false;
break;
}
}
if (temp == true)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(m, 0);
for (int i = 0; i < n; i++) {
int ni;
cin >> ni;
for (int j = 0; j < ni; j++) {
int mi;
cin >> mi;
a[mi - 1] = 1;
}
}
int flag = 1;
for (int i = 0; i < m; i++)
if (a[i] == 0) flag = 0;
if (flag)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int long n, m, x, y;
cin >> n >> m;
map<int, int> a;
for (int i = 1; i <= n; ++i) {
cin >> x;
for (int j = 1; j <= x; ++j) {
cin >> y;
a[y] = 1;
}
}
for (int i = 1; i <= m; ++i) {
if (a[i] != 1) return cout << "NO", 0;
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 5;
bool ans[maxn];
int main(void) {
int n, m;
cin >> n >> m;
memset(ans, false, sizeof(ans));
for (int i = 0; i < n; i++) {
int a, b;
cin >> a;
for (int j = 0; j < a; j++) {
cin >> b;
ans[b] = true;
}
}
int ok = 1;
for (int i = 1; i <= m; i++) {
if (ans[i] == false) {
ok = 0;
break;
}
}
if (ok)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, m, b;
cin >> n >> m;
vector<int> vn;
set<int> s1;
for (int i = 0; i < n; i++) {
cin >> b;
for (int j = 0; j < b; j++) {
cin >> a;
s1.insert(a);
}
}
for (set<int>::iterator it = s1.begin(); it != s1.end(); it++) {
vn.push_back(*it);
}
if (vn.size() != m) {
cout << "NO";
return 0;
} else {
for (int k = 0; k < n; k++) {
if (vn[k] != k + 1) {
cout << "NO";
return 0;
}
}
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool ma[500];
int main() {
int n, m;
cin >> n >> m;
while (n--) {
int q;
cin >> q;
while (q--) {
int y;
cin >> y;
ma[y] = true;
}
}
for (int i = 1; i <= m; i++) {
if (!ma[i]) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int ans = 1, j, n, m, i, x, y, a[105] = {0};
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%d", &x);
for (j = 0; j < x; j++) {
scanf("%d", &y);
a[y] = 1;
}
}
for (i = 1; i <= m; i++) {
ans = ans * a[i];
}
if (ans == 0)
printf("NO\n");
else
printf("YES\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, c, o[100];
cin >> n >> m;
int m1[100];
for (int i = 1; i <= m; i++) {
m1[i - 1] = i;
}
for (int i = 0; i < n; i++) {
cin >> c;
int s = m;
for (int j = 0; j < c; j++) {
cin >> o[j];
}
for (int j = 0; j < m; j++) {
for (int k = 0; k < c; k++) {
if (m1[j] == o[k]) {
m1[j] = 0;
k = c;
}
}
}
}
int flag = 0;
for (int i = 0; i < m; i++) {
if (m1[i] != 0) flag = 1;
}
if (flag == 1)
cout << "NO";
else
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
set<int> s;
while (n--) {
int a;
cin >> a;
int arr[a];
for (int i = 0; i < a; i++) {
int x;
cin >> x;
arr[i] = x;
s.insert(arr[i]);
}
}
if (s.size() == m) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[200];
for (int i = 1; i <= m; i++) a[i] = 0;
for (int i = 1; i <= n; i++) {
int t;
cin >> t;
for (int j = 1; j <= t; j++) {
int x;
cin >> x;
a[x] = 1;
}
}
int f = 0;
for (int i = 1; i <= m; i++) {
if (a[i] == 0) {
f = 1;
break;
}
}
if (f == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> m >> n;
vector<int> v(n);
while (m--) {
int k;
cin >> k;
vector<int> vv(k);
for (auto &y : vv) {
cin >> y;
v[y - 1]++;
}
}
for (auto &x : v) {
if (x <= 0) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, x, y, a[500];
for (int k = 0; k < 500; ++k) a[k] = 0;
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> x;
for (int j = 1; j <= x; ++j) {
cin >> y;
a[y] = 1;
}
}
for (int i = 1; i <= m; ++i) {
if (a[i] == 0) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
const int MAXN = 105;
int a[MAXN];
int main() {
memset(a, 0, sizeof(a));
int n, m, x, y;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
for (int j = 0; j < x; j++) {
scanf("%d", &y);
a[y] = 1;
}
}
bool isOk = false;
for (int i = 1; i <= m; i++) {
if (!a[i]) {
isOk = true;
break;
}
}
if (!isOk)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n;
set<int> set;
cin >> n >> m;
cin.get();
if (n >= 1 && m <= 100) {
for (int i = 0; i < n; i++) {
string s;
int x;
stringstream ss;
getline(cin, s);
ss << s;
ss >> x;
if (x >= 0 && x <= m) {
int y;
while (ss >> y) set.insert(y);
}
}
if (set.size() >= m)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
bool ok[110];
int main() {
int n, m;
cin >> n >> m;
int x, y;
for (int i = 1; i <= n; i++) {
cin >> x;
for (int j = 1; j <= x; j++) {
cin >> y;
ok[y] = 1;
}
}
for (int i = 1; i <= m; i++)
if (ok[i] == 0) {
cout << "NO";
return 0;
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int hit[111] = {0};
int m, n, x, y;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
for (int j = 0; j < x; j++) {
scanf("%d", &y);
hit[y] = 1;
}
}
for (int i = 1; i <= m; i++) {
if (hit[i] == 0) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[105] = {0}, m, n, k, i, b;
scanf("%d %d", &m, &n);
for (i = 0; i < m; i++) {
scanf("%d", &k);
for (int j = 0; j < k; j++) {
scanf("%d", &b);
a[b]++;
}
}
for (i = 1; i <= n; i++) {
if (a[i] == 0) {
printf("NO\n");
break;
}
}
if (i == n + 1) printf("YES\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int ok = 0;
vector<int> v;
set<int> s;
set<int>::iterator k;
int x, y;
while (n--) {
cin >> y;
while (y--) {
cin >> x;
v.push_back(x);
}
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++) {
s.insert(v[i]);
}
int i = 1;
if (s.size() < m) {
cout << "NO" << endl;
return 0;
}
for (k = s.begin(); k != s.end(); k++) {
if (*k != i) {
ok = 1;
break;
}
i++;
}
if (ok == 1) cout << "NO" << endl;
if (ok == 0) cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, n;
bool reachable_bulb[102] = {0};
cin >> n >> m;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
for (int j = 0; j < x; j++) {
int k;
cin >> k;
reachable_bulb[k - 1] = 1;
}
}
bool flag = true;
for (int i = 0; i < m; i++) {
if (reachable_bulb[i] == 0) {
flag = false;
break;
}
}
if (flag)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
set<int> a;
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
for (int j = 0; j < x; j++) {
int y;
cin >> y;
a.insert(y);
}
}
int c = 0;
for (int e : a) c++;
if (c == m)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x, l, j, k, i;
cin >> n >> x;
long long a[x + 1];
for (i = 1; i <= x; i++) {
a[i] = 0;
}
for (i = 0; i < n; i++) {
cin >> l;
for (j = 0; j < l; j++) {
cin >> k;
a[k]++;
}
}
int t = 1;
for (i = 1; i <= x; i++) {
if (a[i] == 0) {
t = 0;
}
}
if (t == 1) {
cout << "YES";
} else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
double CN2(double n) { return n * (n - 1.0) / 2.0; }
bool bulbs[111];
void solve(int n, int m) {
int x;
int y;
for (int i = 1; i <= n; i++) {
cin >> x;
for (int j = 1; j <= x; j++) {
cin >> y;
bulbs[y] = true;
}
}
bool yes = true;
for (int i = 1; i <= m; i++) {
if (!bulbs[i]) {
yes = false;
break;
}
}
if (yes)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
int main() {
int n, m;
cin >> n >> m;
solve(n, m);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m) {
vector<int> puedo(m, 0);
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
for (int j = 0; j < a; ++j) {
int b;
cin >> b;
puedo[b - 1] = 1;
}
}
bool no_puedo = false;
for (int i = 0; i < m; ++i) {
if (puedo[i] == 0) {
no_puedo = true;
break;
}
}
if (no_puedo)
cout << "NO" << endl;
else
cout << "YES" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> A(m);
while (n--) {
int x;
cin >> x;
while (x--) {
int a;
cin >> a;
--a;
A[a] = 1;
}
}
cout << (count(A.begin(), A.end(), 1) == m ? "YES" : "NO") << '\n';
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
set<int> a;
int n, m;
cin >> n >> m;
while (n--) {
int x;
cin >> x;
while (x--) {
int y;
cin >> y;
a.insert(y);
}
}
if (a.size() == m)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, m, x, a, c;
cin >> n >> m;
c = m;
bool arr[m + 1];
for (long long int i = 0; i <= m; i++) arr[i] = 0;
for (long long int i = 1; i <= n; i++) {
cin >> x;
for (long long int j = 1; j <= x; j++) {
cin >> a;
if (arr[a] == 0) {
c--;
arr[a] = 1;
}
}
}
if (c == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
set<int> s;
long long int n, m, k, a;
cin >> n >> m;
while (n--) {
cin >> k;
while (k--) {
cin >> a;
s.insert(a);
}
}
if (s.size() == m) {
cout << "YES"
<< "\n";
} else {
cout << "NO"
<< "\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int oo = 1 << 29, N = 1e5 + 10;
const long double PI = acos(0.0) * 2;
int btns, lights, x, tmp;
bool vis[N];
int main() {
cin >> btns >> lights;
for (int i = 0; i < btns; ++i) {
cin >> x;
for (int j = 0; j < x; ++j) {
cin >> tmp;
vis[tmp - 1] = 1;
}
}
for (int i = 0; i < lights; ++i)
if (!vis[i]) {
puts("NO");
return 0;
}
puts("YES");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, a, d;
vector<int> q[110];
pair<int, int> s[110];
bool mark[110];
bool bl = false;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> a;
s[i] = {a, i};
for (int j = 0; j < a; j++) {
cin >> d;
q[i].push_back(d);
}
}
sort(s, s + n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < q[s[i].second].size(); j++) mark[q[s[i].second][j]] = 1;
}
bl = true;
for (int j = 1; j <= m; j++)
if (!mark[j]) bl = false;
if (bl) return cout << "YES" << endl, 0;
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n = 0;
int m = 0;
int a[110][110];
int x;
int b[110];
int main() {
cin >> n;
cin >> m;
for (int i = 1; i <= m; i++) {
b[i] = i;
}
for (int i = 0; i < n; ++i) {
cin >> a[i][0];
for (int j = 1; j <= a[i][0]; j++) {
cin >> a[i][j];
b[a[i][j]] = 0;
}
}
for (int i = 1; i <= m; ++i) {
if (b[i] == 0) {
x++;
}
}
if (x == m) {
cout << "YES";
} else {
cout << "NO";
}
}
|
#include <bits/stdc++.h>
using namespace std;
bool lambs[101];
int main() {
int n, m;
cin >> n >> m;
while (n--) {
int x;
cin >> x;
while (x--) {
int y;
cin >> y;
lambs[y] = true;
}
}
for (int i = 1; i < m + 1; i++)
if (lambs[i] == false) {
cout << "NO";
return 0;
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
set<int> BulbsOn;
int tmp, tmp2;
for (int i = 0; i < n; i++) {
cin >> tmp;
for (int j = 0; j < tmp; j++) {
cin >> tmp2;
BulbsOn.insert(tmp2);
}
}
if (BulbsOn.size() == m)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, m, e, p;
set<int> w;
int main() {
cin >> a >> b;
for (c = 0; c < a; c++) {
cin >> d;
for (e = 0; e < d; e++) {
cin >> p;
w.insert(p);
}
}
m = w.size();
if (m == b) {
cout << "YES";
return 0;
} else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
bool a[200005];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
for (int j = 0; j < x; ++j) {
int y;
cin >> y;
a[y] = true;
}
}
for (int i = 1; i <= m; ++i)
if (!a[i]) {
cout << "NO";
return 0;
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a[10001], s, f;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> s;
for (int j = 0; j < s; j++) {
cin >> f;
if (a[f] != 1) a[f] = 1;
}
}
for (int i = 1; i <= m; i++) {
if (a[i] != 1) {
cout << "NO";
return 0;
}
}
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9;
const long INFL = (long)1E18;
const int dir[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
vector<int> all;
int main() {
all.clear();
int n, m;
cin >> n >> m;
int tmp;
all.assign(m, 0);
getchar();
for (int i = (0); i < (n); i++) {
string line;
getline(cin, line);
stringstream ss(line);
int ff = 1;
while (ss >> tmp) {
if (ff == 1) {
ff = 0;
continue;
}
all[tmp - 1] = 1;
}
}
bool flag = true;
for (int i = (0); i < (m); i++) {
if (all[i] == 0) {
flag = false;
break;
}
}
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m;
bool mark[123];
int main() {
scanf("%d%d", &n, &m);
memset(mark, false, sizeof(mark));
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
for (int j = 0; j < x; j++) {
int y;
scanf("%d", &y);
mark[y] = true;
}
}
bool ans = true;
for (int i = 1; i <= m; i++) ans = ans && mark[i];
if (ans)
puts("YES");
else
puts("NO");
}
|
#include <bits/stdc++.h>
using namespace std;
bool visited[109] = {0};
int main() {
int n, m, i, cnt, j, x, tmp;
bool flag = 1;
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> x;
for (j = 0; j < x; j++) {
cin >> tmp;
visited[tmp] = 1;
}
}
flag = 1;
for (i = 1; i <= m; i++) {
if (visited[i] == 0) {
flag = 0;
break;
}
}
if (flag == 1)
cout << "YES\n";
else
cout << "NO\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
set<int> st;
int main() {
int button, bulb, x;
cin >> button >> bulb;
for (int i = 0; i < button; i++) {
int b;
cin >> b;
for (int j = 0; j < b; j++) {
cin >> x;
st.insert(x);
}
}
if (st.size() != bulb)
cout << "NO\n";
else
cout << "YES\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
bool bulbs[m + 1];
for (int i = 0; i <= m; i++) bulbs[i] = false;
int count = 0;
for (int i = 0, x; i < n; i++) {
cin >> x;
for (int j = 0, y; j < x; j++) {
cin >> y;
if (!bulbs[y]) count++;
bulbs[y] = true;
}
}
if (count == m)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int INF = 1000000007;
const int MOD = 1000000007;
const int MAXN = 100055;
int main() {
int n, m;
cin >> n >> m;
vector<bool> on(m + 1, false);
while (n--) {
int cnt;
cin >> cnt;
while (cnt--) {
int idx;
cin >> idx;
on[idx] = true;
}
}
bool yes = true;
for (int i = 1; i <= m; ++i) {
yes &= on[i];
}
cout << (yes ? "YES" : "NO") << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
inline bool chmin(T1 &a, T2 b) {
return b < a && (a = b, true);
}
template <class T1, class T2>
inline bool chmax(T1 &a, T2 b) {
return a < b && (a = b, true);
}
using ll = long long;
int main() {
int n, m;
cin >> n >> m;
vector<int> good(m);
for (int i = (0); i < (n); i++) {
int x;
cin >> x;
for (int j = (0); j < (x); j++) {
int y;
cin >> y;
good[y - 1] = true;
}
}
bool ans = true;
for (int i = (0); i < (m); i++) ans &= good[i];
cout << (ans ? "YES" : "NO") << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main(void) {
int aracheck[100] = {0};
int n, m, i, j, k, l;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
int n1;
scanf("%d", &n1);
for (j = 0; j < n1; j++) {
int phi;
scanf("%d", &phi);
aracheck[phi] = 1;
}
}
int count = 0;
for (i = 1; i <= m; i++)
if (aracheck[i] == 1) {
count++;
}
if (count == m)
printf("YES");
else
printf("NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int main() {
int n, m;
cin >> n >> m;
int a[N] = {0};
for (int i = 0; i < n; i++) {
int num;
cin >> num;
for (int j = 0; j < num; j++) {
int k;
cin >> k;
a[k]++;
}
}
for (int i = 1; i <= m; i++) {
if (a[i] == 0) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int bu[30000];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
for (int j = 0; j < x; j++) {
int y;
scanf("%d", &y);
bu[y] = 1;
}
}
for (int i = 1; i <= m; i++) {
if (bu[i] != 1) {
printf("NO");
return 0;
}
}
printf("YES");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int vis[200];
int main() {
int n, m;
scanf("%d%d", &n, &m);
int cnt = 0;
memset(vis, 0, sizeof(vis));
for (int i = 0; i < n; i++) {
int k;
scanf("%d", &k);
for (int j = 0; j < k; j++) {
int p;
scanf("%d", &p);
if (!vis[p]) {
vis[p] = 1;
cnt++;
}
}
}
if (cnt == m)
printf("YES\n");
else
printf("NO\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int X[] = {0, 0, 1, 0, 0, -1};
int Y[] = {0, 1, 0, 0, -1, 0};
int Z[] = {1, 0, 0, -1, 0, 0};
struct node {
int x, y;
node() {}
node(int x, int y) : x(x), y(y) {}
};
int main() {
int i, j, k = 0, l, x, y, z, t, m, n;
cin >> n >> m;
map<int, int> mp;
for (i = 1; i <= n; i++) {
cin >> x;
for (j = 0; j < x; j++) {
cin >> y;
if (mp[y] == 0) k++;
mp[y] = 1;
}
}
if (k == m)
printf("YES");
else
printf("NO");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a, t;
bool r = 1;
cin >> n >> m;
vector<bool> mas(m, 0);
for (int i = 0; i < n; i++) {
cin >> a;
for (int j = 0; j < a; j++) {
cin >> t;
mas[t - 1] = 1;
}
}
for (int i = 0; i < m; i++) {
if (mas[i] == 0) r = 0;
}
if (r == 0)
cout << "NO";
else
cout << "YES";
}
|
#include <bits/stdc++.h>
int mm[110];
using namespace std;
int main(int argc, char *argv[]) {
int t = 1;
for (int z = 1; z < t + 1; z++) {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
for (int j = 0; j < x; j++) {
int y;
cin >> y;
mm[y] = 1;
}
}
bool ff = true;
for (int i = 1; i <= m; i++)
if (mm[i] != 1) ff = false;
if (ff)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int d[110];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
int num, tmp;
scanf("%d", &num);
for (int k = 1; k <= num; k++) {
scanf("%d", &tmp);
d[tmp] = 1;
}
}
for (int i = 1; i <= m; i++)
if (!d[i]) {
printf("NO");
return 0;
}
printf("YES");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
template <typename T>
void _F(const char *name, T arg1) {
cerr << name << " = " << arg1 << '\n';
}
template <typename T, typename... Args>
void _F(const char *names, T arg1, Args... args) {
const char *name = strchr(names, ',');
cerr.write(names, name - names) << " = " << arg1 << '\n';
_F(name + 2, args...);
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &q) {
in >> q.first >> q.second;
return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &q) {
out << q.first << " " << q.second;
return out;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2) {
return {p1.first + p2.first, p1.second + p2.second};
}
template <typename T1, typename T2>
pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2) {
return {p1.first - p2.first, p1.second - p2.second};
}
void solve() {
long long n, m;
cin >> n >> m;
set<long long> s;
for (long long i = 0; i < n; i++) {
long long x;
cin >> x;
for (long long j = 0; j < x; j++) {
long long y;
cin >> y;
s.insert(y);
}
}
if ((long long)((s).size()) == m) {
cout << "YES" << '\n';
} else {
cout << "NO" << '\n';
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long t = 1;
start = clock();
cout << fixed << setprecision(20);
for (long long i = 1; i <= t; ++i) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, m, a[111], k, t, i, j, o;
while (~scanf("%d %d", &n, &m)) {
for (i = 1; i <= m; i++) {
a[i] = 0;
}
for (i = 0; i < n; i++) {
scanf("%d", &k);
while (k--) {
scanf("%d", &t);
a[t] = 1;
}
}
o = 1;
for (i = 1; i <= m; i++) {
if (a[i] == 0) {
o = 0;
break;
}
}
if (o)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, v[105], x, y, b = 1;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> x;
for (int j = 1; j <= x; j++) {
cin >> y;
v[y] = 1;
}
}
for (int i = 1; i <= m; i++) {
if (v[i] != 1) {
b = 0;
break;
}
}
if (b)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
bool can[101];
int main() {
int n, m;
std::cin >> n >> m;
for (int i = 0; i < n; ++i) {
int x;
std::cin >> x;
for (int j = 0; j < x; ++j) {
int y;
std::cin >> y;
can[y] = true;
}
}
bool ok = true;
for (int i = 1; i <= m; ++i) {
if (!can[i]) {
ok = false;
break;
}
}
std::cout << (ok ? "YES" : "NO") << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int b, n, m, x, y, c, z;
int a[105];
while (cin >> n >> m) {
c = 0;
for (int i = 1; i <= m; i++) a[i] = 0;
for (b = 1; b <= n; b++) {
cin >> x;
for (int i = 1; i <= x; i++) {
cin >> y;
a[y] = 1;
}
}
for (b = 1; b <= m; b++) {
if (a[b] == 0) {
c = 1;
break;
}
}
if (c == 0)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
set<int> st;
int main() {
int a, b, k, g;
cin >> a >> g;
for (int i = 0; i < a; i++) {
cin >> k;
for (int j = 0; j < k; j++) {
cin >> b;
st.insert(b);
}
}
if (st.size() == g) {
cout << "YES";
} else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int vis[110];
int main() {
int n, m;
scanf("%d %d", &n, &m);
int i, j;
for (i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
for (j = 1; j <= x; j++) {
int y;
scanf("%d", &y);
vis[y] = 1;
}
}
for (i = 1; i <= m; i++) {
if (vis[i] == 0) {
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, x, j;
cin >> n >> m;
bool b[m];
for (int i = 0; i < m; i++) b[i] = false;
for (int i = 0; i < n; i++) {
cin >> x;
while (x--) {
cin >> j;
b[j - 1] = true;
}
}
for (bool t : b) {
if (!t) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, x, y, a[101] = {0};
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> x;
for (int j = 1; j <= x; j++) {
cin >> y;
a[y] = 1;
}
}
for (int i = 1; i <= m; i++) {
if (a[i] == 0) {
cout << "NO";
return 0;
}
}
cout << "YES";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
unsigned int v[100];
int main(int argc, char* argv[]) {
unsigned int n, m;
cin >> n >> m;
for (unsigned int i = 0; i < n; ++i) {
unsigned int k;
cin >> k;
for (unsigned int j = 0; j < k; ++j) {
unsigned int x;
cin >> x;
v[x - 1] = 1;
}
}
unsigned int r = accumulate(v, v + m, 0);
cout << (r < m ? "NO\n" : "YES\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<bool> l(m, false);
for (int i = 0; i < n; ++i) {
int x, y;
cin >> x;
for (int j = 0; j < x; ++j) {
cin >> y;
l[y - 1] = true;
}
}
bool ans = true;
for (int i = 0; i < m; ++i) {
if (l[i] == false) {
ans = false;
break;
}
}
cout << (ans ? "YES" : "NO");
cin.get();
cin.get();
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool b[100000];
int main() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
int x, y;
cin >> x;
for (int j = 1; j <= x; j++) {
cin >> y;
b[y] = 1;
}
}
int f = 1;
for (int i = 1; i <= m; i++) {
if (b[i] == 0) {
f = 0;
break;
}
}
if (f)
printf("YES\n");
else
printf("NO\n");
}
|
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
cin.tie(0);
ios::sync_with_stdio(false);
}
int main() {
long long n, m;
scanf("%lld", &n);
scanf("%lld", &m);
set<long long> s;
for (long long i = 0; i <= n - 1; i++) {
long long sz;
scanf("%lld", &sz);
for (long long i = 1; i <= sz; i++) {
long long a;
scanf("%lld", &a);
s.insert(a);
}
}
if (s.size() == m)
cout << "YES";
else
cout << "NO";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, x, y;
cin >> n >> m;
int hash[m];
for (int i = 1; i <= m; i++) {
hash[i] = 0;
}
vector<int> v[n];
for (int i = 0; i < n; i++) {
cin >> y;
for (int j = 0; j < y; j++) {
cin >> x;
v[i].push_back(x);
hash[x] = 1;
}
}
int c = 0;
for (int i = 1; i <= m; i++) {
if (hash[i] == 1) {
c++;
}
}
if (c == m) {
cout << "YES\n";
return 0;
}
cout << "NO\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long n, m, x, y, a[10000] = {0};
int main() {
cin >> n >> m;
for (long i = 0; i < n; i++) {
cin >> x;
for (long i = 0; i < x; i++) {
cin >> y;
a[y - 1] = 1;
}
}
bool KT = true;
for (long i = 0; i < m; i++)
if (!a[i]) {
KT = false;
}
if (KT == true)
cout << "YES";
else
cout << "NO";
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a[110];
cin >> n >> m;
for (int i = 0; i <= m; i++) a[i] = 0;
for (int i = 0; i < n; i++) {
int temp;
cin >> temp;
for (int j = 0; j < temp; j++) {
int x;
cin >> x;
a[x] = 1;
}
}
int res = 0;
for (int i = 1; i <= m; i++)
if (a[i] == 0) res = 1;
if (res == 1)
cout << "NO" << endl;
else
cout << "YES" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
static void amax(T &x, U y) {
if (x < y) x = y;
}
template <typename T, typename U>
static void amin(T &x, U y) {
if (x > y) x = y;
}
int main() {
int n, m, x, y;
scanf("%d%d", &n, &m);
vector<int> a(m + 2);
for (int i = 0; i < (n); i++) {
scanf("%d", &x);
for (int j = 0; j < (x); j++) scanf("%d", &y), ++a[y];
}
for (int i = 1; i <= m; i++)
if (!a[i]) return printf("NO\n"), 0;
printf("YES\n");
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
bool flag[101];
memset(flag, false, sizeof flag);
int n, m, x, y;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
cin >> x;
for (int i = 0; i < x; ++i) {
cin >> y;
flag[y] = true;
}
}
int c = 0;
for (int i = 1; i <= m; ++i) {
if (flag[i]) c++;
}
if (c == m) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
bool A[102];
int main() {
int n, m, x, y;
cin >> n >> m;
bool flag = true;
for (int i = 0; i < n; ++i) {
cin >> x;
for (int j = 0; j < x; ++j) {
cin >> y;
A[y - 1] = 1;
}
}
for (int i = 0; i < m; ++i) {
if (!A[i]) flag = false;
}
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long n, m, x, y;
long long a[101];
int main() {
cin >> n >> m;
for (int k = 0; k < n; k++) {
cin >> x;
while (x--) {
cin >> y;
a[y]++;
}
}
for (int i = 1; i < m + 1; i++) {
if (!a[i]) {
cout << "NO";
return 0;
}
}
cout << "YES";
}
|
#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, k = 0;
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
cin >> n >> m;
set<int> s;
k = m;
while (n--) {
cin >> y;
while (y--) {
cin >> x;
s.emplace(x);
}
}
cout << (s.size() == k ? "YES\n" : "NO\n");
}
|
#include <bits/stdc++.h>
using namespace std;
int a[1000];
int main() {
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
int k, x;
cin >> k;
while (k--) {
cin >> x;
a[x] = 1;
}
}
for (int i = 1; i <= m; i++) {
if (!a[i]) return cout << "NO", 0;
}
return cout << "YES", 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.