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_RSQ(n); for (int i = 0; i < n; i++) { st.Set(i, a[i]); } for (int i = 0; i < h[1]; i++) { var q = Read(); if (q[0] == 0) { st.Set(q[1], q[2]); } else { Console.WriteLine(st.Get(q[1], q[2])); } } Console.Out.Flush(); }
static void Main() { var r = new List <long>(); var h = Read(); var n = h[0]; var st = new ST_RSQ(n + 1); 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)); }