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 | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
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.
Name |
---|
Matrix Exponentiation
try 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.
The 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.
Recursion. 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.
Because 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.
First, 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.
Straightforward DP.
What is with the ranking? It shows my rank when I am logged in but not otherwise??