This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bisect = (l, r, cond) => { | |
| while (l <= r) { | |
| const m = (l + r) >> 1; | |
| if (cond(m)) { | |
| l = m - 1; | |
| } else { | |
| r = m + 1; | |
| } | |
| } | |
| return l; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UnionFind { | |
| constructor(size) { | |
| this.groups = new Array(size); | |
| this.ranks = []; | |
| for(let i = 0; i < size; i++) { | |
| this.groups[i] = i; | |
| } | |
| } | |
| find(node) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find /run/network -name 'ifstate.*' | egrep -w -v -e `ifconfig | grep veth | cut -d' ' -f1 | xargs echo | tr ' ' '|'` | xargs -n1 rm |