MCODE - MCURIOUS help with WA

problem link https://www.codechef.com/MCOD2020/problems/MCURIOUS
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 : https://www.codechef.com/viewsolution/35730436
@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.

https://www.codechef.com/viewsolution/35736096 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