CF1416B Make Them Equal
Description
You are given an array $ a $ consisting of $ n $ positive integers, numbered from $ 1 $ to $ n $ . You can perform the following operation no more than $ 3n $ times:
1. choose three integers $ i $ , $ j $ and $ x $ ( $ 1 \le i, j \le n $ ; $ 0 \le x \le 10^9 $ );
2. assign $ a_i := a_i - x \cdot i $ , $ a_j := a_j + x \cdot i $ .
After each operation, all elements of the array should be non-negative.
Can you find a sequence of no more than $ 3n $ operations after which all elements of the array are equal?
Input Format
N/A
Output Format
N/A