use std::collections::HashMap; fn main() { let mut hwq = String::new(); std::io::stdin().read_line(&mut hwq).ok(); let hwq: Vec = hwq.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let h = hwq[0]; let w = hwq[1]; let q = hwq[2]; let queries = (0..q).map(|_| { let mut temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp: Vec = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); (temp[0]-1, temp[1]-1) }) .collect::>(); let mut mins = HashMap::new(); let mut summary = h*w; for &(y, x) in queries.iter() { let val = *mins.get(&x).unwrap_or(&h); if val < y { println!("{}", summary); } else { summary -= val - y; mins.insert(x, y); println!("{}", summary); } } }