The year is about to end, and so is the ACM ICPC season with the India Final 2016! After 4 onsite contests, with almost 600 teams participating and intense battles between the best teams, we’re here to present you live updates from IIITM Gwalior where the ACM ICPC India Final 2016 is happening today! Stay tuned for interesting insights from the arena, problem discussions and more!
Live Leaderboard: www.codechef.com/rankings/ACM16INF
10:00 IST: The contest has begun. The problem set consists of 11 problems.
10:08 IST: No submissions on any problem yet.
10:13 IST: No submissions still. Teams might strategize to minimize their time penalty today, as it can play a huge role in the final leaderboard.
10:15 IST: We have our first accepted submission! Problem I has been solved by team SRY from Delhi Technological University!
Problem I is called “Pacman” – surprisingly, it is not related to the game in any way but it is based on the name of a Software Package Manager.
This problem has been set by Vaibhav Tulsyan (that’s me!).
The problem is as follow:
You are given a list of softwares and their dependencies. Each software has at most one dependency and there are no cyclic dependencies. Also, each software has a download limit D[i]. Given a subset of ultra-special softwares, you want to find the maximum no. of “completely installable” softwares. By “completely installable”, we mean that its entire chain of dependencies must first be downloaded, and then the software itself should be downloaded. Each ultra-special software does a fresh install of all its dependencies.
The first solution one may think of is finding the max flow in a transformed graph. A new graph can be constructed by splitting each node into an edge with capacity = D[i] value of that node. A source node will have edges to all ultra-special softwares with capacity = 1 and all nodes which don’t have dependencies, can have edges to a Sink node with capacity = infinity. The answer would be the value of max flow in this graph. The implementation can be done using Dinic‘s algorithm.
However, from some observation, it can be deduced that one can select any ultra-special software and completely install it, if it is possible. Hence, all you need to do is traverse over all the dependencies of the ultra-special software uptil the highest parent, keeping track of the download limit and updating the download limits while traversing. This is a O(N^2) solution.
There also exists a Dynamic Programming solution which is that in each node, store the minimum of: D[i] of the current node and sum(D[j]) of all children j of node i. This runs in O(N).
10:46 IST: 20 teams now have Accepted Submissions on Problem I.
FruitSalad have solved Problem E as their first problem! However, they got 1 penalty on that problem.
Team SRY remain atop the leaderboard.
10:51 IST: Team believe from MNNIT are the first team to solve 2 problems and now lead the scoreboard with 0 penalties.
FruitSalad have solved Problem I and have 2 problems solved as well – although with 1 penalty. They are now at Rank 2.
11:00 IST: 1 hour into the contest, only 2 teams have solved more than 1 problem.
Let’s discuss Problem E – Jumping Frogs III.
We have Triveni Mahatha with us who has described the problem in brief as follows:
“The problem is about finding maximum number of frogs in a segment of an infinitely long road (x-axis) at any instant of time. Frogs are moving with constant speed in the x-axis. Initial position of the frogs and their velocity are given.
The solution is that, for every frog find out the time range for which they are at any point in the given segment. Then among these time ranges you need to find a time which is contained by max number of ranges. This can be done by sorting the intervals and doing line sweep greedily. Fairly popular problem.”
11:05 IST: AC on Problem H for Team Rocket!
They have solved 3 problems and lead the ranklist.
11 teams now have at least 2 problems solved.
The live leaderboard can be seen here: https://codechef.com/rankings/ACM16INF
11:15 IST: Team mobius_treap gets AC on Problem A! They are the first team to solve that problem. This is their 2nd solved problem in the contest.
11:25 IST: Team Hopeless solves Problem B.
11:32 IST: FacelessMen solve Problem A and move to rank 2 with 3 problems with 1 penalty.
mobius_treap solve Problem E and move to rank 3 – they have 2 total penalties.
11:35 IST: Triangulation get AC on Problem H. They seem to have used a Persistent Trie + Binary Search for their solution.
11:36 IST: Team Rocket have solved Problem C and increase their lead with 4 problems solved.
Let’s discuss Problem A now. You are given a number N of the from p * q. Where p and q are prime numbers. p may be equal to q.
You need to distribute N balls into k buckets such that every bucket gets equal number of balls.
It is clear that k can be either 1, N, p or q. You need to be alert that you are not counting twice for p and q if they are equal.
Print the answer modulo mod.
There are few things to observe here.
First how to factorize N which can be 10^12. But since max(p,q)/min(p,q) <= 10. It is easy by just doing brute-force.
Next observation is that the value of mod is small, this will be useful. Let’s first arrive at the solution.
Distributing N balls into k buckets is a fairly standard task in combinatorics. Say y = N/k then the number of ways is N!/(y! ^ k).
Here you may not take modular inverse as the denominator can have multiple of mod, since mod is very small.
So, rather you actually factorize the numerator and denominator to get the answer. Note that you need not go to prime factors more than mod. Because if the answer contains mod then answer is zero anyways.
That’s all about this problem. However, you need to be careful while implementing the idea. So many modulos and few cases as well. Factorization should be fast enough. Use sieve.
11:42 IST: Team Survivor from IIT Indore solve Problem L – a geometry problem. They are now at Rank 2 with 4 problems solved.
11:51 IST: Almost 2 hours into the contest, we have 7 distinct problems solved, with the top team solving a total of 4 problems.
Problem L, authored by Triveni is a really interesting geometry problem.
Quoting Triveni’s explanation of the problem and the possible solutions:
“Problem L is about finding approximate-smallest enclosing circle of N points in Cartesian plane. Smallest enclosing circle can be defines as a circle with minimum possible radius such that all the given points are either inside or on the circle.
If we allow few (4 for this question) points to be outside the circle, this is approximate smallest enclosing circle problem.
There are many possible solutions to this problem as the constraints are very small. N is just 51
I will discuss few.
Few things to observe. At most three points are needed to define the circle.
So we chose any three points and make the circumcircle. If all but 4 points are inside this then we have got an answer. complexity O(N^4). Fairly simple.
Another is based on Weizl’s algorithm.
You select any three points and make SEC of all the remaining points. If there are more than 3 points on the circle then you can not do much by removing one more point from the set. However, if there less than 4. Then we can try removing one point from the circle and regenerate the SEC of remaining points.
Weizl’s algorithm computes SEC in O(N). Its a randomized las-vegas algorithm. So random shuffling of points is needed to avoid TLE.
Total complexity is O(N^4) for this as well.
Apart from this one can write O(N^5) solution with optimizations to get AC.
12:05 IST: Team Rocket have 5 problems solved and 2 penalties – Rank 1.
12:17 IST: thirdfloor have solved Problem D – they are the first to solve this problem and have moved up to Rank 4.
Balajiganapathi says that he expects more teams to solve D and is surprised with such a small number of submissions on that problem.
12:22 IST: FruitSalad solve their 3rd Problem with Problem H! They are at Rank 10 now.
8 distinct problems with the top team having solved 5. That says a lot about the diversity of difficulty of the problem-set.
12:33 IST: mobius_treap from IIIT Hyderabad at Rank 3 with 4 problems and 2 penalties.
12:47 IST: third floor have solved 5 problems and are now at Rank 2!!
Problem selection will be very, very important for the top teams now. With only a couple of hours remaining, they can’t afford to spend time on a problem and reach a dead-end.
12:52 IST: mobius_treap solve Problem H and are now are Rank 2, displacing third floor to the 3rd spot.
12:56 IST: mobius_treap solve Problem L and now are at Rank 1! 2 ACs within 5 minutes, they’re on fire today!!
1:28 IST: mobius_treap solve their 7th Problem and lead the ranklist. Survivor have now solved 6 problems and are at Rank 2, followed by FacelessMen with 6 problems at Rank 3.
1:29 IST: FruitSalad solve Problem L.
1:53 IST: As we approach towards the final hour of the contest, team mobius_treap looks comfortable at the top with 7 solved problems to their name.
2:00 IST: The final hour of the contest is in progress and the ranklist has been frozen. It means no more updates fromo us till the result announcement. So, join us back for the result announcements to find out who wins the first ever ACM ICPC India Finals.
4:00 IST: We are back live from the chilly campus of ABV IIITM, Gwalior, where the first ACM ICPC 2016 Multi-Site India Fials concluded, with some teams taking the part into the contest from Kolkata. And it is time to raise the mercury a bit with the final results of this ACM ICPC season. So, brace yourselves.
4:10 IST: The second runner-up is Team “Survivor” of Indian Institute Of Technology, Indore. A big round of applause for them.
4:15 IST: The first runner-up is Team “Rocket” of Indian Institute Of Technology, Bombay. Give it for them.
4:20 IST: And finally the big one. The winner of the first ever ACM ICPC India Finals is Team “mobius_treap” of International Institute Of Information Technology, Hyderabad. Great job guys. They seem to be making a habit out of it. And we are very pleased that they are.
4:30 IST: With that, it’s time to let the Sun set on ACM ICPC season for the year 2016 and the year 2016 itself. We hope you had a wonderful year, and have big plans for the coming year. So, on that note, from everyone here at CodeChef here’s wishing you and your love ones, a Very Happy New Year. Have a wonderful evening folks.
This is wittyceasor signing off for the final time in the year, 2016. See you on the other side.
- Vaibhav Tulsyan