Example #1
0
        public static void Solve()
        {
            var(N, Q) = Scanner.Scan <int, int>();
            var A   = Scanner.ScanEnumerable <int>().ToArray();
            var seg = new SegTree <int>(A, (a, b) => Math.Max(a, b), -1);

            for (var i = 0; i < Q; i++)
            {
                var(T, X, V) = Scanner.Scan <int, int, int>();
                X--;
                if (T == 1)
                {
                    seg.Set(X, V);
                }
                else if (T == 2)
                {
                    Console.WriteLine(seg.Prod(X, V));
                }
                else if (T == 3)
                {
                    Console.WriteLine(seg.MaxRight(X, v => v < V) + 1);
                }
            }
        }