Rust solution
rust\nimpl Solution {\n    pub fn three_equal_parts(arr: Vec<i32>) -> Vec<i32> {\n        let v = arr\n            .iter()\n            .enumerate()\n          
```rust\nimpl Solution {\n    pub fn three_equal_parts(arr: Vec<i32>) -> Vec<i32> {\n        let v = arr\n            .iter()\n            .enumerate()\n            .filter_map(|(i, &a)| if a == 1 { Some(i) } else { None })\n            .collect::<Vec<_>>();\n        if arr.len() < 3 || v.len() % 3 != 0 {\n            return [-1, -1].to_vec();\n        }\n        if v.is_empty() {\n            return [0, 2].to_vec();\n        }\n        let chunks = v.chunks(v.len() / 3).collect::<Vec<_>>();\n        let i = chunks[0][v.len() / 3 - 1] + arr.len() - v[v.len() - 1] - 1;\n        let j = chunks[1][v.len() / 3 - 1] + arr.len() - v[v.len() - 1];\n        if arr.len() - chunks[2][0] > j - i - 1 || arr.len() - chunks[2][0] > i + 1 {\n            return [-1, -1].to_vec();\n        }\n        for k in 0..(i + 1).min(j - i - 1).min(arr.len() - j) {\n            if arr[i - k] != arr[j - 1 - k] || arr[i - k] != arr[arr.len() - 1 - k] {\n                return [-1, -1].to_vec();\n            }\n        }\n        [i as i32, j as i32].to_vec()\n    }\n}\n```
['Rust']