Hi everyone, I was solving the problem from the recently ended contest May Circuits! https://www.hackerearth.com/may-circuits/algorithm/make-n00b_land-great-again-circuits/
But I faced a really strange problem! Here my AC submission: https://ideone.com/QxhGT6
// -----
int hey = update2(l, r, x, (v == -1 ? -1 : t2[v].l), tl, tm);
t2[now].l = hey;
hey = update2(l, r, x, (v == -1 ? -1 : t2[v].r), tm + 1, tr);
t2[now].r = hey;
// -----
/* t2[now].l = update2(l, r, x, (v == -1 ? -1 : t2[v].l), tl, tm);
t2[now].r = update2(l, r, x, (v == -1 ? -1 : t2[v].r), tm + 1, tr);*/
But if replace the first part with the second, even sample isn't working! I really need your help.