Comments

thanks a lot, now i got it.

thanks for giving your precious time.

no, i don't know how to calculate smallest x when m is prime.

thanks for such a nice explanation.

but if we have to find smallest value of x (which is equal 4 in above example) then how it can be calculate.

thanks for your explanation.

but for your given example, a = 60, m = 126, for b = 18, answer should be 4, but after calculation of m1 and m2, m2 = 7 which gives value of x = 1 then how to come up with final solution(x = 4), correct me if i'm wrong

can you elaborate the calculations of m1.

yeah maybe this one of the reason

i'm not related to the camp, i'm just telling the truth of indian education system. now a days competitive programming is just a way to getting a decent job especially in india.

i don't know and how would i know?

what do u mean?

it seems that you guys not wants to learn something, instead you just had to go to the camp to have fun or to pass your time in summer holidays. as you guys are making fake id and arguing here, rather than waiting for videos upload by codechef.

+1

thanks man, now i got it.

but what should be the termination condition as one city can be visited more than one time also.

+1

can anyone help me, how to approach this question.

i know about bitmasking, but in this case man can move any city more than one time also, for e.g. in given test case he move to city 3 , three times. my problem is how to solve this situation. means in bitmasking we move to any city only one time. i also write code for simple bitmask but it not handle this situation.

Code

yes the constraints is low,value of n is less than or equal to 8, sorry but i'm not able to clearly understand what r u saying, can u please elaborate.

0

thanks

0

thanks

0

thanks

-28

thanks for explanation. is there any other mathematical proof to prove this?

thanks now i understand

no, i mean as you said map the weight of edge (parent-child) to the child but root has no parent so what value is map to the root of the tree?

and what about the weight of root?

How can apply this method if weight is given on edges instead vertices

thanks it also works.

thanks now it works.

When I run this command terminal shows -v command not found

real 0m0.085s user 0m0.076s sys 0m0.004s

am i missing something?

thanks. i understand now

is there any function as we can calculate total execution time using clock function in c++, is there a library or something else that can print total memory taken as online judges shows how much memory taken by program, i want to calculate it for experimental purpose, i know the formula that you are answer me but i want actual memory same as online judges shows to us. do you know how online judges calculating total memory consumed by our program?

i need to calculate memory on my computer, is there any other way? as i need to experimental comparison of space complexity of two algorithms for my project