I am writing this blog mainly for 2 reasons. One is to discuss the problems. I want to know what is the logic behind C Large. And also if we can get a count of how many people got full points in the round.

# | User | Rating |
---|---|---|

1 | tourist | 3496 |

2 | moejy0viiiiiv | 3288 |

3 | W4yneb0t | 3218 |

4 | TakanashiRikka | 3178 |

5 | Petr | 3173 |

6 | izrak | 3109 |

6 | Um_nik | 3109 |

8 | anta | 3106 |

9 | ershov.stanislav | 3105 |

10 | dotorya | 3089 |

# | User | Contrib. |
---|---|---|

1 | rng_58 | 173 |

2 | csacademy | 169 |

3 | Swistakk | 158 |

4 | Petr | 157 |

4 | tourist | 157 |

6 | Errichto | 151 |

7 | Zlobober | 145 |

8 | matthew99 | 141 |

9 | Endagorion | 137 |

10 | BledDest | 136 |

I am writing this blog mainly for 2 reasons. One is to discuss the problems. I want to know what is the logic behind C Large. And also if we can get a count of how many people got full points in the round.

↑

↓

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/11/2017 18:10:40 (c2).

Desktop version, switch to mobile version.

User lists

Name |
---|

HintMatrix Exponentiation

hinttry to find probabilities of starting at each vertex after some x rounds. And now with small trick(not hard) to take sum during exponentiation it is done.I leave tiny details for you to try out.

Hint for B please ?

It's Greedy. First sort the given array. Then check if you can dance. If you can't dance, check if you can recruit.

From the available teams, for dancing, dance with the team which has least energy. And for recruiting, recruit the team which has highest energy.

Main logicThe following observations were important:

You can process the teams in any order (ie. decide to dance, recruit or truce) because if he current one isn't the one you want to process you can just make an excuse

Recruiting is most beneficial when done against highest energy teams

Dancing is most beneficial when done against lowest energy teams

Can you elaborate a bit more please(for C large) ?

My solutions

Problem 1.

AnsRecursion. It's true if the list is empty or when pivoting as described, one of the sublists is empty and the recursive call is true.

Problem 2.

AnsBecause we can excuse or ignore teams, we can choose any subset of the teams in any order. Also, if we are to beat a team, we should beat the weakest one; and if we are to recruit a team, we should recruit the strongest one. Thus our strategy is going to take the form of: "Defeat teams until we can't, then recruit a team" and we will repeat this.

Problem 3.

AnsFirst, use Floyd's algorithm to find dist[i][j] (0 indexed). Now, notice that if you are not home, you are in every other location with equal probability. If you are at home (location 0) then the expected travel time to your destination is sum(dist[0]) / (N-1). If you are away (ie., not at home), then the expected travel time to your destination is sum(dist[1:]) / (N-1)^2. Also, we can figure out the transition function: if you are home with probability x, then on the next monster you are home with probability (1-x)/(N-1).

To solve the problem for large, you need one extra fact. For the function f(x) = (1-x)/(N-1), getting within 1e-9 of the limit of the orbit lim_{i ->inf} f^i(1) = 1/N is done very quickly. Indeed, let's look at abs(x — f(x)) = abs(Nx — 1)/(N-1), suggesting f^i(1) -> 1/N. To prove it, abs(f(x) — f(f(x))) = abs(Nf(x) — 1)/(N-1) = abs(N(1-x) — (N-1))/(N-1)^2 = abs(Nx — 1)/(N-1)^2. So the differences are getting smaller by a factor of 1/(N-1) each time.

Problem 4.

AnsStraightforward DP.

For problem B, my solution is incorrect. Can some body help here?

My code

What is with the ranking? It shows my rank when I am logged in but not otherwise??