Could someone explain the best solution to the tie-breaker TRICOL Nov19 Challenge Div. 2, please?

The code for it is here.

It looks quite simple. Only changing colors of points, no edge flips. Trying different random changes. Why inside one iteration do we keep decreasing the number of colors changed like this:
for (int i=1;i<=getnum(T);i++)c[rnd()%n+1]=rnd()%3;
?
where T goes (T = T_Max=1e4; T > T0=0.0001; T *= delta=0.9995) and
int getnum(double x){ return (int)log(x+1)/2+1; }
?
And what is the second case in which we make the change tested in this if statement:
if ((val>kkk||exp((double)(val-kkk)/T)>((double)rnd()/rnd.max()))&&kkk!=1e9){ for (int i=1;i<=n;i++)a[i]=c[i]; }
?

tie breaker for what??

Well, the Nov19 challenge. Division 2.
I updated the title.

1 Like