Documente Academic
Documente Profesional
Documente Cultură
Report𝝱
k 1 2 3 4 5 6 7 8 9 10 11
n 92 60 37 27 20 10 3 0 0 0 0
6. Top 10 Teams:
9 BUET_BloodHound 6 1108
8 BUET_FIX_IT_FELIX 6 1088
7 BUET_Deadbeats 6 1082
6 JU_Circavex 6 929
5 JU MSB 6 782
2 DU_Censored 7 1002
For each cell(from left to right), you have to calculate the maximum he can collect for each cell
of the current column considering it to be the rightmost column.
Let the current column be ‘j’ and all the previous columns have been calculated. Now to
calculate for each row ‘i’ of the current column, you have to maximize considering 3 cases.
First Case: He has entered the current column, j , in the i’th row, that is, the transition has
occurred from grid [i][j-1] to grid[i][j].
Second Case: He has entered j’ th column in k’th row and gone down (took help of the dragon if
required) to reach i’th row, that is, he has first moved from grid[k][j-1] to grid[k][j] and then moved
down to reach grid[i][j].
Third Case: This is similar to second case just he moves up instead of going down.
For calculating 2nd and 3rd case, an n^2 loop is required to find the optimum k and i which
results in an mn^2 soln. But a little thinking will help you find out that a greedy approach reduces
the n^2 loop to O(n) and can be achieved by 2 pointers.
So the resulting complexity is O(nm).
Complexity: O(nm)
Problem E: Oh Functions
Problem Setter: Muhammad Ridowan Alternate Writer: Md. Ali Noor Jamil
First Solve: #Team Solved:
Solution: The main trick is expanding the both function and make it with simpler form with no
bracket. After some observation you could see f(n) + g(n) = 3 * ( f(n-1) + g(n-1) )2. As f(0)+g(0) is
2n − 1
3, this is equivalent to 3 . Now we can compute this using fermat's little theorem which
states that for prime modular P, taking the mod of the power with P-1 is equivalent to original
equation.
Now observing them little more will reveal that f(n)- 2g(n) = 12( f(n-1)-+ 2g(n-1) ) - 21. This can
be solved by matrix exponent or expanding it.
Now from f(n) + g(n) and f(n)- 2g(n) we can calculate the value of f(n) and g(n).
Expected Complexity: O(lgN)
Problem K: Kinderbijslag
Problem Setter: Mohammed Hafiz Uddin Alternate Solution: F.A.Rezaur Rahman
First Solve: #Team Solved:
Solution: This is a real life problem of setter. We have no idea how to solve it.
Special thanks to Md. Mahbubul Hasan for reviewing our problem set and solutions.