Output any set of distinct integers from 1 to 500 such that there are no three elements s_1+s_2=s_3.
Since n is up to 100, one can just output integers from 500-n to 499. Sum of any two such integers is greater than 500 so requirements will be satisfied.
One other solution is to output the first n odd integers, i.e. 1, 3, 5, 7 and so on. Sum of any two odd numbers is even, which won’t be present in this set.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution will be updated soon.
Tester’s solution will be updated soon.
Editorialist’s solution can be found here.