Hello Everyone!
We present you our Annual Programming Contest, CodeZilla, which is a part of BITOTSAV '17, the annual fest of Birla Institute Of Technology, Mesra. It will be a ACM-ICPC style 3-hour contest. Registration for the contest is free and open to all. Participation can be in teams of at most 3 members.
We promise you a really exciting and challenging set of problems!
Contest starts at 14th March, 2017 21:00 IST
Check in your timezone here
Register at: http://bit.ly/register_codezilla
Link to Contest: https://www.codechef.com/COZI2017
The top teams will be invited for the Onsite finals.
Happy Coding :)
Gentle reminder : Contest is about to start :)
Nice problems :) How to solve Chef and Food Delivery
Take root of the tree as 1. Precalculate the number of children of each node.
Calculate answer for the root.
Now do a dfs traversal. Suppose x is the current node and y is the node to which we will go. Let e be the edge weight and child[y] represent the number of children of y.
The paths till y will have their weights decremented by e (there will be a total of child[y] such paths)
The paths till x will have their weights incremented by e (there will be a total of n-child[y] such paths)
How to solve chef and kites? And please make the solutions public.
It is actually very similar to COCI 2016/2017 CONTEST #6 P5. You can build the mst only with n log n edges. First merge i and j for zero cost if a[i] % a[j] = 0, then for every distinct a[i], add edge between i and j with cost a[j] % a[i], if a[j] > a[i] * p, where p >= 0 and there isn't exist a[k] s.t. a[i] < a[k] < a[j], i.e. a[j] is the first number in a that strictly larger than a[i] * p. Total cost of the mst is the answer.
When you said it is very
similar
, I go check it...CODOPEDIAC3 is the author of the problem :D
Solution or hints for Hogathon ?
Hi,
well — not sure, whether it is correct (I hope so) but here's our approach.
Two facts:
A) You can use every node ([x,y]) just once
B) The grind (under dominoes) is Bipartite Graph
Well, from these fact one shall consider Matching :) Anyway:
I) The matching is not maximal (just matching up to K)
II) You are not interested in matching itself (it will in most cases be K) but for some value of it (you want maximal such value) => So we want matching with cost :)
So what now — Let us consider following matching (capacity/cost):
(Source1) → K/0 → Source2 →→→ 1/0 →→→ WhiteSquare →→1/INF-CostA-CostB →→ BlackSquare →→ 1/0 →→ Sink
If you execute this matching [Min Cost Max Flow], and subtract it from "flow*INF", you will get the sum of squares you won't consider — so subtracting this value from sum of all squares will get the right answer.
Well you might see a problem here: The size of parity is ~4.5*10^6 which is NOT sufficient for bipartite matching. But if you give it a small observation, you'll see, that there is no reason to consider ALL pairs of adjacent squares. Well if we consider optimal solution, it would be somewhere BETWEEN those pairs with the biggest sum of values.
Off-course the most valued pairs might overlap, and it might lead to iniquity, so we shall find the bound of "enough" points (well or we can pick a VERY BIG VALUE {which is enough for mcmf}).
SO: Get input → process all edges → sort edges be sizes → create reduced bipartite graph → do MCMF-algo → $$ Profit
Good Luck & Have Nice Day!
Hi. How many pairs have u picked for the optimal solution? I tried picking 40 paris but got wrong answer. How do you calculate to know how many is enough.
Hello,
well unfortunately I don't know.. :'( A teammate's option was "48" {I can't see through it} — but I've set the constant as "3000" [just to be sure] which worked fine
Please move the problems to practice section for upsolving