Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

Добро пожаловать на 2014-2015 CT S02E09: Codeforces Trainings Season 2 Episode 9 - 2006-2007 ACM-ICPC Northeastern European Regional Contest (NEERC 06). Продолжительность тренировки — 5 часов. Тренировка открыта как для команд, так и для индивидуальных участников. После ее окончания вы можете дорешивать задачи тренировки или поучаствовать в ней виртуально, если не смогли принять участие одновременно со всеми. Пожалуйста, участвуйте в тренировке честно.

Так как это тренировка, то возможно набор задач будет расширен, если для значительного количества участников он окажется простым.

Условия задач будут на английском языке, ведь мы же готовимся к ACM-ICPC!

Удачи!

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

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

hello everyone!! can you help me ?

why in the problem I: Interconnect the answer for second case is 1.5

input: 4 2 1 2 3 4

output: 1.5

???

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

hello everyone!! can you help me??

why in the problem I : Interconnect the answer for the second case is 1.5

input

4 2

1 2

3 4

output

1.5

???

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

    With probability , we'll connect 1-2 or 3-4, leading to the same connectedness. With probability , we'll connect 1 or 2 with 3 or 4. Therefore, the expected time is .

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

      thanks you !! I get a accepted

      I thought who E = 1/3 * ( E ) + 2/3 -> E = 1

      thanks you!!

      I solve this problem with memorization with map<vector,double> are there some best idea??

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

        I used map<hash(vector),double> and another map<hash(vector),vector> to find out which vector it is.

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

How to solve problem I?

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

    I did it with dynamic programming. First I used disjoint sets (or connected components would work fine) to calculate the sizes of all the connected components of the graph. Then, my recursive dynamic programming state was a sorted list of those sizes (the total number of states is somewhere around the 30th partition number. At each state I did the following sum:

    For each pair of element of my list of sizes, the number of edges I could add is just the product of their sizes — call this p. Since there are n choose 2 total edges in the graph, the probability that I connect these components is p / (n choose 2). So I add to my sum p / (nchoose 2) * (1 + dp(new list with these components combined)).

    However, if I add up the probabilities for all of these combinations, they may not sum to 1 since there's the case when I add in an edge to the same component. For this, just observe the following formula, letting x be the probability that I choose two nodes in the same component: dp(list) = (sum above) + x * (1 + dp(list))

    This can be rewritten as dp(list) = ((sum above) + x) / (1 — x)

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

      You need to link with http://, or it'll be considered an inner (to CF) link.

      It's pretty much just bruteforce — listing all possible states (multisets of component sizes).

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

How to solve C ? I've found solution using matrix multiplication, but size of matrix is too large and, of course, I get TLE on test 9.

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

    You can calc only one row from matrix, all others will be same with shift. O(lg(K)*N^2)

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

Is there any Editorial for this contest