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

Автор chrome, 10 лет назад, По-русски

Всем привет!

Сегодня Завтра в 20:00 MSK состоится Topcoder SRM 677.

Предлагаю обсудить задачи здесь после контеста.

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

»
10 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +44 Проголосовать: не нравится

chrome is back !

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

Looking at the Topcoder Dashboard, it seems like Topcoder is making an attempt to improve user experience for good! The "Launch Arena" button also directly redirects to the web arena, instead of asking me to download an application.

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

Bumping this, since it starts in about 12 hours from now.

»
10 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +13 Проголосовать: не нравится

Печально...

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

I see. Your job here is to remind us about topcoder contests.

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

I can't open the Arena, anyone is experiencing the same issue?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

What about Web Arena? Did someone use in recent matches? Were any bugs?

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

This will be my first match on TopCoder. I have few doubts.

  1. Will submission points decrease if my solution fails to compile or doesn't pass batch test?

  2. If i don't submit any problem's code then also my rating will be affected?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

How to do div1 500?

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

    DP[v][i][j] — probability that diameter of subtree rooted at v will be i and longest path from v to leaf of this subtree will be j.

    When you are merging two trees — you try both possible values for added edge; new deepest vertex is trivial, new diameter of subtree is either diameter of some of two old parts or path connecting deepest vertices in two parts (depending on which one is longer).

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

    First for each subtree and each d between 0 and n calculate probability that subtrees depth will be at most d. Then choose center of graph and length of diameter. There are 2 cases: center is on vertex, or center is on edge. In first case depth of tree should be half of diameter and there should be at least 2 subtrees with that depth. In second case each end of our edge should have fixed depth, which depends on the position of center on edge and edge length.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Where is instant post-match editorial when you need it the most? ;_;

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

How to solve div2 Hard ?

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

    I had a weird DP solution for Div2 900

    Let dp(i,j) denote the length of smallest palindromic path between node-i and node-j

    Note that dp(i,j) = -1 if there is no pair (u,v) such that (u,i) and (v,j) are valid edges and label on (u,i) is equal to label on (v,j).

    The base cases will be:

    dp(i,j) = 0 if i==j (trivial)

    dp(i,j) = 1 if (i,j) have an edge between them.

    Now we can loop over all pairs (u,v) such that (u,i) and (v,j) are valid edges and label on (u,i) is equal to label on (v,j). Our answer for dp(i,j) will be 2+min(dp(u,v)) for all (u,v)

    Our final answer will be dp(0,1). Sample Code: Link

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +59 Проголосовать: не нравится

cgy4ever is the writer of this round. It seems he may be busy now, so I'll post solutions for him.

Here is code:

div2: http://pastebin.com/sgnpradR

div1: http://pastebin.com/PLHbRYF9

some hints:

  • div2 easy: just do what's described in the statement.
  • div2 med: 2 approaches 1) The string has length at most 40. Brute force 40^4 tuples of positions that the 4 strings can take on. 2) Try all orders of concatenating the string together (how do you merge two strings?)
  • div2 hard: Make a new graph where new vertices are a pair of original vertices. What are the edges in this new graph?
  • div1 easy: 2 approaches 1) Fix the number of multiply by 2 operations. Now, we can proceed greedily. 2) Work backwards (i.e. operations are divide by 2 or subtract 1).
  • div1 med: 2 approaches: 1) Root the tree arbitrarily. Compute prob(tree has diameter <= x) using a dp based on longest path to leaf. 2) Find the probability that the graph has a particular center and diameter. The center can either be a vertex or at the middle of an edge.
  • div1 hard: First, any strongly connected tournament graph has a hamiltonian cycle. Find any such one. Then, we can do bubble sort (see code for more details). (Tricky case for div1 hard. A cycle 0->1->...->29->0. All other edges go from bigger numbers to smaller numbers.)
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится