Skip to content

Instantly share code, notes, and snippets.

@icub3d
Created January 12, 2026 19:58
Show Gist options
  • Select an option

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

Select an option

Save icub3d/e79bef44840cb6354d3de46c2ee669a4 to your computer and use it in GitHub Desktop.
Kattis volim
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut ss = s.lines();
let mut cur = ss.next().unwrap().parse::<isize>().unwrap();
ss.next();
let mut time = 210;
for l in ss {
let (t, r) = l
.split_once(' ')
.map(|(t, r)| (t.parse::<isize>().unwrap(), r))
.unwrap();
time -= t;
if time <= 0 {
break;
}
// 1's counting
if r == "T" {
cur = cur % 8 + 1;
}
}
println!("{cur}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment