#include <iostream>
#include <vector>
using namespace std;
struct node {
int num;
vector<int> conns;
};
int main()
{
int n, q;
cin >> n >> q;
//vector<node> vec(n);
int a, b;
//vec[0].num = 0;
for (int i = 1; i < n; i++) {
//vec[i].num = i;
cin >> a >> b;
a--; b--;
//vec[a].conns.push_back(b);
//vec[b].conns.push_back(a);
}
int new_num;
for (int i = 0; i < q; i++) {
cin >> new_num;
for (int j = 0; j < new_num; j++) {
cin >> a;
}
if ((n - 1) % 2 == 1) {
cout << "-1" << endl;
}
else cout << n - 1 + new_num << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
85 ms |
680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
134 ms |
684 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |