#include <bits/stdc++.h>
using namespace std;
int n, m, k, l, r, a[100001], ai, bi, counter;
bool flag;
int main()
{
cin >> n >> m;
counter = m;
for (int i = 0; i < m; ++i){
cin >> ai;
a[ai] = 1;
}
cin >> k;
for (int i = 0; i < k; i++){
cin >> l >> r;
flag = true;
for (int j = 0; j < l; ++j){
cin >> bi;
if (not a[bi]) flag = false;
}
for (int j = 0; j < r; j++){
cin >> bi;
if (flag and not a[bi]){
counter++;
a[bi] = 1;
}
}
}
cout << counter << endl;
for (int i = 0; i < 100001; i = i + 1){
if (a[i]) cout << i << " ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
408 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
74 ms |
1672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
90 ms |
1784 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
2316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |