Skip to content

Instantly share code, notes, and snippets.

@icub3d
Created January 29, 2026 20:09
Show Gist options
  • Select an option

  • Save icub3d/3bc9abdb1d778adf6a04e8c8bb7f7c9a to your computer and use it in GitHub Desktop.

Select an option

Save icub3d/3bc9abdb1d778adf6a04e8c8bb7f7c9a to your computer and use it in GitHub Desktop.
Kattis exactlyelectrical
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut ss = s.split_whitespace().map(|v| v.parse::<isize>().unwrap());
let (x0, y0, x1, y1, t) = (
ss.next().unwrap(),
ss.next().unwrap(),
ss.next().unwrap(),
ss.next().unwrap(),
ss.next().unwrap(),
);
let dist = (x0 - x1).abs() + (y0 - y1).abs();
// u-turn divisible by 2
if t >= dist && (t - dist) % 2 == 0 {
println!("Y");
} else {
println!("N");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment