Sunteți pe pagina 1din 4

BUET Inter University Programming Contest, 2016

Report​𝝱

1. Total 11 problems​, ~92 Teams participated onsite.


2. Onsite Judge:
Kaysar Abdullah, Md. Ali Noor Jamil, Muhammad Ridowan,
Radi Muhammad Reza, Shafaet Ashraf
Big thanks to CodeMarshal!
And thanks to Jami Bhai & Shiplu bhai for guiding us.
3. Issues During Judging:
We had to change the data of problem B. But no team had to get penalty for this. We
fixed it within 10 minutes of first wrong verdict.

​ SU Aristocrats​, Time: 7min


4. First Accepted Submission: Problem K, Team Name: N
5. At least k problems solved by n teams:

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:

Pos Team Name University Solved Penalty

10 IOI - Travelling 6 1353


Salesmen

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

4 NSU Aristocrats 6 600

3 BUET Omnitrix 7 1021

2 DU_Censored 7 1002

1 BUET Rayo 7 619


Analysis

Problem A: The Hater of Powers


Problem Setter: Md. Ali Noor Jamil Alternate Writer: Muhammad Ridowan
First Solve: #Team Solved: 1
Solution:​ Store all third and above powers below 10​18​ according to the greatest exponent. This
can be done in around 10​6​ iterations and the greatest exponent would be 59. Calculate range of
positions for every powers, including squares (by deducting count of even powers from 10​9​) and
non-powers (by deducting total count of powers from 10​18​). For every query if the query position
falls in the range of the stored powers output from there, else if it falls in range of squares,
binary search on the squares from 2 to 10​9​ for correct answer and for non-powers binary search
from 2 to 10​18​ instead. For every search iteration ensure that mid value is not a power itself
otherwise increment it, and avoid any infinite loop by breaking the search whenever difference
of right and left is less than six.

Problem B: War in the Wizarding World


Problem Setter: Anindya Das Alternate Solution: Mir Wasi Ahmed
First Solve: #Team Solved:
Solution: First, the shortest path length from Hub 1 to n has to be calculated and any edge
which can be a part of this shortest path has to be excluded from the graph. How? For any edge
(u,v), if distance(1,u) + distance(u,v) + distance(n,v) = shortest_path_distance_from_1_to_n,
then exclude it. Then you need to calculate the shortest path again on this graph. To disconnect
1 from n with minimum sum of edge length, we need to find the minimum cut, i.e. the maximum
flow from Hub 1 to Hub n. The graph is large, so you need to use Dinic’s algorithm.
Expected Complexity: O(n^2*m) because of Dinic’s complexity: O(V^2*E)

Problem C: The Wall


Problem Setter: F.A.Rezaur Rahman Alternate Solution: Kaysar Abdullah
First Solve: #Team Solved:
Solution​: If we take the convex hull of both sets of points, we can then only consider the points
and lines in the convex hull. We can use O(mn) for getting the minimum distance between the
two convex hull. But we can use a faster sweep algorithm(rotating calipers) using the convexity
of the hull which will be O(m+n).

Problem D: Perseus And The New Challenge


Problem Setter: Mohammad Ullah Farsid Alternate Writer: Md. Nafis Sadique
First Solve: #Team Solved:
Solution:​ Dynamic Programming with some Greedy and 2 pointers optimization

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 F: Boring Game


Problem Setter: Md. Nafis Sadique Alternate Writer: Shafaet Ashraf
First Solve: #Team Solved:
Solution: ​If n = 2, then the result is 0. If the tree is a star then the result is n-1, otherwise n. It
can be proven using simple game theory.
Expected Complexity: O(n)
Problem G: Mario and Princess Peach
Problem Setter: Sheikh Moinul Hasan Alternate Writer: Sheikh Shakib Ahmed
First Solve: #Team Solved:
Solution​: Simple DP problem. Maximum possible score from a cell depends on score of every
cell mario can jump to. So DP[i][j] = max( DP[i][j+k] , DP[i+k][j] ) for all 1<=k<= P(i,j) and target
cell is within grid. You need to reduce the time complexity by using data structure such as
segment tree. You will need to handle (N+M) segment trees, one for each row and one for each
column.
Expected Complexity: O( N*M*logN + N*M*logM )

Problem H: Different Standings


Problem Setter: Anindya Das Alternate Solution: Sadia Nahreen
First Solve: #Team Solved:
Solution: The simple solution is to start with choosing r athletes for the 1st place, then r+1
athletes for the 1st place etc. and multiplying the number of ways we can place the remaining
athletes in k-1 positions. This would be a O(n^2*r*k) solution, which will not pass. We can think
about the number of ways the athletes can be distributed into exactly v sets, where each set will
have at least r elements. When r = 1, it refers to Stirling Number of 2nd kind. We can generalize
that for any r and precompute it for all possible values of n, r and k. Then, for every test case,
we can calculate the answer in O(k), i.e. ans = sum_v_from_1_to_k v!*Stir2(n,r,v).
Expected Complexity: O(n*r*k + T*k).

Problem I: Gold Mines


Problem setter: Shafaet Ashraf Alternate Writer: Shakib Ahmed
First Solve: #Team Solved:
Solution:​ It’s a floodfill + shortest path problem. You can find all the cells adjacent to a gold
mine using floodfill. After that you can shortest path of each pair of potential cells using simple
BFS. It’s an straight-forward problem but need careful coding.

Problem J: Final Days of Goldfinger


Problem Setter: Kaysar Abdullah Story Credit and Alternate Writer: Md. Ali Noor Jamil
First Solve: #Team Solved:
Solution:​ It’s a segment tree data structure problem. This problem can be modeled to finding a
pair of indexes (i, j) from H[l,k] such that H[k]-H[l] is maximized.
Expected Complexity: QlogN

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.

S-ar putea să vă placă și