Cod sursa(job #1021881)

Utilizator florin.elfusFlorin Elfus florin.elfus Data 4 noiembrie 2013 13:10:46
Problema Arbore Scor 0
Compilator cpp Status done
Runda Lista lui wefgef Marime 1.01 kb
//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;
}