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

2 | Petr | 3353 |

3 | OO0OOO00O0OOO0O0…O | 3314 |

4 | fateice | 3306 |

5 | Um_nik | 3286 |

6 | Syloviaely | 3274 |

7 | dotorya | 3145 |

8 | LHiC | 3114 |

9 | Radewoosh | 3098 |

10 | mnbvmar | 3096 |

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

1 | tourist | 178 |

2 | rng_58 | 166 |

3 | Petr | 156 |

4 | csacademy | 155 |

5 | Swistakk | 149 |

5 | lewin | 149 |

7 | Um_nik | 142 |

8 | Errichto | 141 |

9 | matthew99 | 138 |

10 | Vovuh | 136 |

10 | ko_osaga | 136 |

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

The only programming contests Web 2.0 platform

Server time: Jun/21/2018 20:57:17 (d2).

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