Example #1
0
    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();
    }
Example #2
0
    public ST_RUSQ(int n)
    {
        while (n2 < n)
        {
            n2 <<= 1;
        }
        n2 <<= 1;
        a1   = new long[n2];
        a2   = new long[n2];

        rsq = new ST_RSQ(n);
        rsq.Set(n - 1, 1);
        for (int i = n - 1; i > 0; i--)
        {
            rsq.Set(i - 1, rsq[i] * 10 % M);
        }
    }
Example #3
0
    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));
    }