static void Main() { Console.SetOut(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); var h = Read(); var n = h[0]; var a = Read(); var st = new ST_RMQ(n + 2); for (int i = 0; i < n; i++) { st.Set(i + 1, a[i]); } st.Set(n + 1, 1 << 30); for (int k = 0; k < h[1]; k++) { var q = Read(); if (q[0] == 1) { st.Set(q[1], q[2]); } else if (q[0] == 2) { Console.WriteLine(st.Get(q[1], q[2] + 1)); } else { Console.WriteLine(st.First(q[1], n + 2, q[2])); } } Console.Out.Flush(); }
static void Main() { var r = new List <long>(); var h = Read(); var n = h[0]; var st = new ST_RMQ(n); st.InitAllLevels(int.MaxValue); for (int i = 0; i < h[1]; i++) { var q = Read(); if (q[0] == 0) { st.Set(q[1], q[1] + 1, q[2]); } else { r.Add(st.Get(q[1], q[2] + 1)); } } Console.WriteLine(string.Join("\n", r)); }