Company: Eternal
Difficulty: medium
The Encrypted Array A cybersecurity analyst is trying to decrypt a secret array A of N integers. The raw elements of the array are completely hidden. The analyst has, however, intercepted a log file containing Q entries. Each entry gives the exact sum of a contiguous subarray of A , from index L to index R inclusive (1-indexed): A[L] + A[L+1] + ... + A[R] The log file records which subarray each sum belongs to, and the numeric value of that sum. The elements of A are otherwise unrestricted integers. Your task is to determine exactly which individual elements of A are pinned down by this information. An element A[i] is uniquely deducible if every array of integers consistent with all Q intercepted sums has the same value at position i ; otherwise A[i] cannot be determined. Note that the actual numeric values of the sums are irrelevant to this question: whether an element is deducible depends only on which ranges were intercepted. That is why the input below lists only the ranges. Input