Skip to content

Instantly share code, notes, and snippets.

@maksverver
Created December 6, 2022 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maksverver/076bbda59488f5e146084dd8499e5bf4 to your computer and use it in GitHub Desktop.
Save maksverver/076bbda59488f5e146084dd8499e5bf4 to your computer and use it in GitHub Desktop.
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