#include <bits/stdc++.h>
#define bismillah ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long
#define v vector
#define pb push_back
#define ppb pop_back
#define all(x) x.begin(), x.end()
#define rall(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define tc int t = 1; while (t--)
// #define tc int t; cin >> t; while (t--)
const int MOD = 1e9 + 7;
const int INF = 1e17;
using namespace std;
signed main(){
bismillah;
tc {
//input
int n; cin >> n;
v<bool> forbidden(105);
for (int i = 0; i < n; i++) {
int x; cin >> x;
forbidden[x] = true;
}
int m; cin >> m;
v<int> food[m];
for (int i = 0; i < m; i++) {
int k; cin >> k;
for (int j = 0; j < k; j++) {
int x; cin >> x;
food[i].pb(x);
}
}
//solve
int ans = 0;
for (int i = 0; i < m; i++) {
bool add = true;
for (auto u: food[i]) {
if (forbidden[u]) {
add = false;
break;
}
}
ans += add;
}
//output
cout << ans << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |