Is the value of max calculated only once at the beginning of the loop or is it calculated for each turn?

Please help.

I want to help you, but the contest is still going on. Read the question properly, try the testcases on paper, you’ll understand.

I’m not asking for a solution.

i want to know whether max is calculated at each turn or only once

Codechef dont ask about your procedure or algo but it has to be right.

You have to think which algo is best for you…and work efficiently.

@sameer_1994: Can you tell me how you understood this:

During a turn the maximal value over all A i is chosen,

let’s call it MAX

?