MCODE - MCURIOUS help with WA

problem link CodeChef: Practical coding for everyone
i assume in this problem we were basically given a tree and we had to move up the tree refilling fuel and summing up total cost.

if so why is this code wrong : CodeChef: Practical coding for everyone
@cypher0900

arenā€™t you calculating the total cost? I think the problem asks for the maximum cost

i am confused is that supposed to be max out of individual costs because movements are so strict.?
i should have read properly indeed it was. but it still yeild WA.

ā€œATERP wants to know what is the maximum reimbursement received by any researcherā€

1 Like

I saw also other problem, there may be others, your variable ā€œyā€ should be long long I think

1 Like

yes i have a bad habit of defining with ints, so sometimes i use precompiler #defined int long long. but still it is a WA.

:see_no_evil:

Ok, I thought you were closer. You are reading M costs while there are N of them, you assign them 0-indexed but then you number the cities from 1. Soā€¦thereā€™s serveral lines to modify.

1 Like

thankyou, i am only human and i make a lot of mistakes. :laughing:

update : finaly this green tick

i would add that, this line in problem statement is misleading @admin.

Each time before refilling the tank, the capacity of the jth researcherā€™s tank becomes fj times the previous capacity.

CodeChef: Practical coding for everyone as ā† in this code i am multiplying y (which is my current doctorsā€™s fuel capacity) with y in each iteration.

but in the accepted code y is being multiply by the initial value of y (which was give in input).

1 Like