I was solving problem C. Circular RMQ. Then i faced a problem, at first i get Time limit exceeded Here!, So i think that i am wrong in something like the whole idea or a bug in the code so i spent hours to find this wrong and i found nothing. But when i removed the line return min(rmq(...),rmq(...));
randomly in rmq function and i put instead of it int p1 = rmq(...), p2 = rmq(...); return min(p1,p2);
it actually works and get accepted here. So i think min() function go crazy or some thing when it have two recursive calls in it, am i right ? or there is another thing i don't notice ?
Thanks in advance.
UPD: Built-in min() function don't have this problem.
In some implementations min is not function, but define
#define min(x, y) (((x) < (y))?(x):(y))
, and it really calls arguements twice. If include algorithm you probably will not have such problem.UPD btw, i checked your code after writing comment. You have exactly this define in your code.