Average Counting Problem (acp)

12 teams scored 460 points on this task, for a maximum score of 100, an average score of 38 and a median score of 42.

Highlights

  1. Marconi - Mangano, Catania is the institute with the most points (200).
  2. Sicilia is the region with the most points (202).

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.