diff --git a/Data Structures Class Template.cpp b/Data Structures Class Template.cpp index 1c37b0b..4b92a03 100644 --- a/Data Structures Class Template.cpp +++ b/Data Structures Class Template.cpp @@ -1382,8 +1382,8 @@ struct Tree void calceuler() { eulercnt = 0; - level.assign(2*n, 0); - euler.assign(2*n, 0); + level.assign(2*n+1, 0); + euler.assign(2*n+1, 0); depth.assign(n, 0); firstocc.resize(n); dfseuler(0, -1); @@ -1404,22 +1404,22 @@ struct Tree { for(int i = 0; i < eulercnt; i++) { - rmqtable[i][j] = eulercnt; + rmqtable[j][i] = eulercnt; if(i + (1< firstocc[v]) swap(u, v); - //cout << firstocc[u] << ' ' << firstocc[v] << ' ' << rmq(firstocc[u], firstocc[v]) << ' ' << euler[rmq(firstocc[u], firstocc[v])] << endl; + //cerr << firstocc[u] << ' ' << firstocc[v] << ' ' << rmq(firstocc[u], firstocc[v]) << ' ' << euler[rmq(firstocc[u], firstocc[v])] << endl; return euler[rmq(firstocc[u], firstocc[v])]; }