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 | 3509 |

2 | OO0OOO00O0OOO0O0…O | 3327 |

3 | Syloviaely | 3274 |

4 | Um_nik | 3237 |

5 | Petr | 3161 |

6 | fjzzq2002 | 3137 |

7 | LHiC | 3135 |

8 | Benq | 3130 |

9 | ko_osaga | 3115 |

10 | Swistakk | 3089 |

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

1 | Radewoosh | 185 |

2 | rng_58 | 161 |

3 | tourist | 158 |

4 | Petr | 152 |

5 | Swistakk | 150 |

5 | Vovuh | 150 |

7 | Um_nik | 148 |

8 | PikMike | 147 |

9 | csacademy | 146 |

10 | Errichto | 145 |

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-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/25/2018 03:23:21 (f1).

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??