Problem regarding atcoder test series


I am not being able to solve this question even after solving the editorial…Please help

hello @Somasree

are ur aware of sieve ?here for this problem we can iterate in similar fashion and assign all multilple of i with a[i]+1.(a[i]+1 becuase its minimum number that is not equal to a[i])
where a[1] will be 1 the minimum most element and remaining we will construct while iterating.
something like this.

 a[1] = 1; 
  	for (int i = 1; i * 2 <= n; ++i) {
     	for (int j = 2 * i; j <= n; j += i) a[j] = a[i] + 1; 
    }

yes I am aware of seive

then refer above logic, u will find it familiar

If the question says “print one that minimizes the maximum value in the sequence.”
then why in the output there’s 4 integers

look at the output format they want u to print the array…

it says “additionally, there is no sequence satisfying these conditions where the maximum value in the sequence is 2 or less so this is a valid solution”.
Sample output-
1 2 2 3
But here the max value in output is more than 2??

they are saying there is no sequence with maximum value 2 or less than that.

yeah that is what they are saying

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.