This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef LOCAL
#include "catdog.h"
#endif
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <random>
#include <complex>
#include <iomanip>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;
vector <int> g[N];
void initialize(int n, vector <int> a, vector <int> b) {
for (int i = 0; i + 1 < n; ++i) {
--a[i], --b[i];
g[a[i]].push_back(b[i]);
g[b[i]].push_back(a[i]);
}
}
int cat(int v) {
--v;
return 0;
}
int dog(int v) {
--v;
return 0;
}
int neighbor(int v) {
--v;
return 0;
}
#ifdef LOCAL
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
int n, q;
cin >> n >> q;
vector <int> a(n - 1), b(n - 1);
for (int i = 0; i + 1 < n; ++i) {
cin >> a[i] >> b[i];
}
initialize(n, a, b);
for (int i = 0; i < q; ++i) {
int t, v;
cin >> t >> v;
if (t == 1) {
cout << cat(v) << '\n';
} else if (t == 2) {
cout << dog(v) << '\n';
} else {
cout << neighbor(v) << '\n';
}
}
}
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |