fn main() { let x = trisearch(0, -100, 100); let y = trisearch(1, -100, 100); let z = trisearch(2, -100, 100); println!("! {} {} {}", x, y, z); } fn trisearch(i: usize, mut lo: i32, mut hi: i32) -> i32 { use std::cmp::Ordering::*; let mut dl = query(i, lo); let mut dr = query(i, hi); while hi - lo > 2 { let k1 = lo + (hi - lo) / 3; let k2 = hi - (hi - lo) / 3; let d1 = query(i, k1); let d2 = query(i, k2); match (dl.cmp(&d1), d1.cmp(&d2), d2.cmp(&dr)) { (Less, _, _) => {hi = k1; dr = query(i, hi)}, (Greater, Less, _) => {hi = k2; dr = query(i, hi)}, (_, Greater, Less) => {lo = k1; dl = query(i, lo)}, _ => {lo = k2; dl = query(i, lo)} } } assert!(hi - lo == 2); let d1 = query(i, lo); let d2 = query(i, (lo+hi)/2); let d3 = query(i, hi); match (d1.cmp(&d2), d2.cmp(&d3), d3.cmp(&d1)) { (Less, _, Greater) => lo, (_, Greater, Less) => hi, _ => (lo + hi) / 2 } } fn getd(x: i32, y: i32, z: i32) -> i32 { println!("? {} {} {}", x, y, z); get::val::() } fn query(i: usize, k: i32) -> i32 { match i { 0 => getd(k, 0, 0), 1 => getd(0, k, 0), _ => getd(0, 0, k) } } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; pub fn val() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().parse::().ok().unwrap() } pub fn vals(n: usize) -> Vec { let mut vec: Vec = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); (x, y) } pub fn tuples(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); let z = it.next().unwrap().parse::().ok().unwrap(); (x, y, z) } pub fn tuple3s(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn list() -> Vec { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().split_whitespace().map(|t| t.parse::().ok().unwrap()).collect() } pub fn lists(h: usize) -> Vec> { let mut mat: Vec> = vec![]; for _ in 0 .. h { mat.push(list()); } mat } pub fn chars() -> Vec { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); buf.trim_right().chars().collect() } }