Prefix Sums solution in C++ language.- Codechef
Prefix Sums Problem Code: UNQEQ For a positive, even even integer � N , we call a pair of arrays � A and � B to be interesting if they satisfy the following conditions : ∣ � ∣ = ∣ � ∣ = � / 2 ∣ A ∣ = ∣ B ∣ = N /2 i.e. the length of array � A is equal to the length of array � B . Each integer from 1 1 to � N occurs exactly once in exactly one of the arrays. The � � ℎ i t h prefix sum of � A is not equal to � � ℎ i t h prefix sum of � B for all 1 ≤ � ≤ � / 2 − 1 1 ≤ i ≤ N /2 − 1 . Formally, ∑ � = 1 � � � ≠ ∑ � = 1 � � � j = 1 ∑ i A j = j = 1 ∑ i B j for all 1 ≤ � ≤ � / 2 − 1 1 ≤ i ≤ N /2 − 1 Sum of all elements in � A is equal to sum of all elements in � B i.e. ∑ � = 1 � / 2 � � = ∑ � = 1 � / 2 � � j = 1 ∑ N /2 A j = j = 1 ∑ N /2 B j You are given a p...