This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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";
}
else cout << n - 1 + new_num;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |