Rust + UnionFind
\nimpl Solution {\n    pub fn distance_limited_paths_exist(n: i32, mut edge_list: Vec<Vec<i32>>, queries: Vec<Vec<i32>>) -> Vec<bool> {\n        let mut idx: Ve
```\nimpl Solution {\n    pub fn distance_limited_paths_exist(n: i32, mut edge_list: Vec<Vec<i32>>, queries: Vec<Vec<i32>>) -> Vec<bool> {\n        let mut idx: Vec<_> = (0..queries.len()).collect();\n        idx.sort_by_key(|&i| queries[i][2]);\n        edge_list.sort_by_key(|v| v[2]);\n\n        let mut uf: Vec<usize> = (0..n as usize).collect();\n        fn uf_find(i: usize, uf: &mut [usize]) -> usize {\n            if (uf[i] != i) {\n                uf[i] = uf_find(uf[i], uf);\n            }\n            uf[i]\n        }\n        fn uf_union(i: usize, j: usize, uf: &mut [usize]) {\n            let i = uf_find(i, uf);\n            let j = uf_find(j, uf);\n            uf[i] = j;\n        }\n\n        let mut ret = vec![false; queries.len()];\n        let mut j = 0;\n        for i in idx {\n            while j < edge_list.len() && edge_list[j][2] < queries[i][2] {\n                uf_union(edge_list[j][0] as usize, edge_list[j][1] as usize, &mut uf);\n                j += 1;\n            }\n            ret[i] = uf_find(queries[i][0] as usize, &mut uf) == uf_find(queries[i][1] as usize, &mut uf);\n        }\n        ret\n    }\n}\n```
['Rust']