Блог пользователя skull_crusher

Автор skull_crusher, 8 лет назад, По-английски

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!

The top teams will be invited for the Onsite finals.

Happy Coding :)

  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Gentle reminder : Contest is about to start :)

»
8 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Nice problems :) How to solve Chef and Food Delivery

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится +7 Проголосовать: не нравится

    Take root of the tree as 1. Precalculate the number of children of each node.

    1. Calculate answer for the root.

    2. 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)

    Code
»
8 лет назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

How to solve chef and kites? And please make the solutions public.

  • »
    »
    8 лет назад, # ^ |
    Rev. 4   Проголосовать: нравится +22 Проголосовать: не нравится

    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.

»
8 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Solution or hints for Hogathon ?

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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!

    • »
      »
      »
      8 лет назад, # ^ |
        Проголосовать: нравится +5 Проголосовать: не нравится

      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.

      • »
        »
        »
        »
        8 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        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

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Please move the problems to practice section for upsolving