Pagini recente » Cod sursa (job #950464) | Cod sursa (job #1969517) | Cod sursa (job #79154) | Cod sursa (job #92085) | Cod sursa (job #1021881)
//to be continued..
#include <stdio.h>
#include <vector>
#include <bitset>
using namespace std;
vector <int> G[100100];
bool vis[100100];
int timp, out[100100], in[100100];
int A[100100], B[100100];
bitset <1000100> s[330];
void dfs(int nod) {
vector <int> :: iterator it;
vis[nod] = true;
in[nod] = ++timp;
for (it = G[nod].begin(); it != G[nod].end(); ++it)
if (!vis[*it])
dfs(*it);
out[nod] = timp;
}
int main() {
freopen("arbore.in", "r", stdin);
freopen("arbore.out", "w", stdout);
int N, M;
scanf("%d%d", &N, &M);
for (int i = 1; i < N; ++i) {
int xx, yy;
scanf("%d%d", &xx, &yy);
G[xx].push_back(yy);
G[yy].push_back(xx);
}
dfs(1);
for (int i = 1; i <= M; ++i) {
int type;
scanf("%d", &type);
if (type == 1) {
int p, s;
scanf("%d%d", &p, &s);
int xx = in[p], yy = out[p];
}
}
return 0;
}