Created
December 6, 2022 17:28
-
-
Save maksverver/076bbda59488f5e146084dd8499e5bf4 to your computer and use it in GitHub Desktop.
This file contains 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 DATA: &[u8; 10_000_000] = include_bytes!("../input_extra.txt"); | |
pub fn main() { | |
let mut total = 0; | |
let mut w = 0; | |
let mut n = 1; | |
'main: while n <= 94 { | |
let mut seen = 0u128; | |
for i in (0..n).rev() { | |
let mask = 1 << DATA[w + i]; | |
if seen & mask == mask { | |
w += i + 1; | |
continue 'main; | |
} | |
seen |= mask; | |
} | |
total += w + n; | |
n += 1; | |
} | |
println!("{}", total); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment