Example #1
0
        public override void Solve(IOManager io)
        {
            var n       = io.ReadInt();
            var queries = io.ReadInt();
            var a       = new MaxInt[n];

            for (int i = 0; i < a.Length; i++)
            {
                a[i] = new MaxInt(io.ReadInt());
            }

            var segtree = new LazySegmentTree <MaxInt, Nothing>(a);

            for (int q = 0; q < queries; q++)
            {
                var type = io.ReadInt();

                if (type == 1)
                {
                    var i = io.ReadInt() - 1;
                    var v = io.ReadInt();
                    segtree[i] = new MaxInt(v);
                }
                else if (type == 2)
                {
                    var l = io.ReadInt() - 1;
                    var r = io.ReadInt();
                    io.WriteLine(segtree.Query(l, r).Value);
                }
                else
                {
                    var l = io.ReadInt() - 1;
                    var v = io.ReadInt();
                    io.WriteLine(Math.Max(l, segtree.FindMaxRight(l, ai => ai.Value < v)) + 1);
                }
            }
        }