Given a positive integer N. Output any array A of length N, such that
- A_i+A_j\ne A_k for all 1\le i,j,k\le N
- 1\le A_i\le 10^5 for all valid i.
The array [10^5-1,10^5-2,\dots,10^5-N] is a valid solution, for the given constraints on N.
It is trivial to show that the requirement 1\le A_i\le 10^5 holds for all valid i. All we are left to do is prove A_i+A_j\ne A_k for all valid i,j,k.
Thus, we have shown the correctness of our solution.
per test case.
Editorialist’s solution can be found here
Experimental: For evaluation purposes, please rate the editorial (1 being poor and 5 excellent)