Cod sursa(job #2128787)
| Utilizator | Data | 12 februarie 2018 05:29:01 | |
|---|---|---|---|
| Problema | Lowest Common Ancestor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include<fstream>
#include<list>
#include<cmath>
using namespace std;
ifstream fin("lca.in");
ofstream fout("lca.out");
const int NMAX = 100005, LOG2NMAX = 18;
list<int> graph[NMAX];
int nodesCount, T;
inline void read_data(){
fin >> nodesCount >> T;
int node, father;
for(node = 2; node <= nodesCount + 1; ++node){
fin >> father;
graph[father].push_back(node);
}
}
int main(){
read_data();
}
