Average Counting Problem (acp)

6 teams scored 132 points on this task, for a maximum score of 42, an average score of 22 and a median score of 22.

Highlights

  1. Banfi, Vimercate is the institute with the most points (42).
  2. Lombardia is the region with the most points (84).

Statement

You are given an array A = [A_0, …, A_N-1] consisting of N non-negative integers. You need to process Q queries, each of one of the following two types: (1) 1 l r val: Assign the value val to each element A_l, A_l+1, …, A_r. (2) 2 l r: Let A' be the subarray A[l, r], i.e., A'_i = A_l + i for each i = 0, …, r - l. Consider the set S of all arrays B of length r - l + 1 such that 0 ≤ B_i ≤ A'_i for all 0 ≤ i < r - l + 1. Compute the sum of all contiguous subarrays of all arrays in S, and output the result modulo 10^9 + 7.