using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] ans = new int[3]; for (int i = 0; i < ans.Length; i++) { ans[i] = GetNum(-100, 100, i + 1); } Console.WriteLine("! " + string.Join(" ", ans)); } private Dictionary> dic = new Dictionary>(); private int GetNum(int min, int max, int idx) { int idx1 = min + (max - min) / 3; int idx2 = min + 2 * (max - min) / 3; long[] nums = new long[4]; nums[0] = GetQuery(min, idx); nums[1] = GetQuery(idx1, idx); nums[2] = GetQuery(idx2, idx); nums[3] = GetQuery(max, idx); long minVal = nums.Min(); if(nums[0] == minVal) { if(idx1-min<=1) { return min; } return GetNum(min, idx1, idx); } if(nums[1] == minVal) { if(idx1-min<=1&&idx2-idx1<=1) { return idx1; } return GetNum(min, idx2, idx); } if(nums[2] == minVal) { if(idx2-idx1<=1&&max-idx2<=1) { return idx2; } return GetNum(idx1, max, idx); } if(max-idx2<=1) { return max; } return GetNum(idx2, max, idx); } private long GetQuery(int num , int idx) { if(!dic.ContainsKey(num)) { dic.Add(num, new Dictionary()); } if(dic[num].ContainsKey(idx)) { return dic[num][idx]; } String[] command = new string[3].Select(a => "0").ToArray(); command[0] = "?"; command[idx] = num.ToString(); Console.WriteLine(string.Join(" ", command)); long ans = long.Parse(Reader.ReadLine()); if(ans < 0) { throw new Exception("valid inpt :" + string.Join(" ", command)); } dic[num][idx] = ans; return ans; } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }