Skip to content

Commit

Permalink
オイラーツアーなら区間が取得できないとだめだろって思った。
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukkku committed Jul 3, 2023
1 parent d450d3f commit 8da20a3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions euler_tour/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ export class EulerTour {
return this.#cost[v];
}

/**
* 頂点に対応する区間を返す
* @param v 対象の頂点
* @returns [`retVal[0]`, `retVal[1]`)の形の半開区間
*/
range (v: number): [number, number] {
return [this.#l[v], this.#r[v]];
}

*[Symbol.iterator]() {
for (const v of this.#data) {
yield v;
Expand Down

0 comments on commit 8da20a3

Please sign in to comment.