TCO 2014 Algorithm Round 2A will be held today at 20:00 Moscow time . Those who previously advanced in Round 1 may compete in this round. First 50 places advance to Round 3. Good luck!
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | 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 | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
TCO 2014 Algorithm Round 2A will be held today at 20:00 Moscow time . Those who previously advanced in Round 1 may compete in this round. First 50 places advance to Round 3. Good luck!
Name |
---|
Arena doesn't work with Ubuntu again?
It doesn't work for me too >_< Does anyone know how to fix it? It would be so disappointing to miss this round because of this.
Edit: the Topcoder forum's URL is also broken. No idea how can we contact admin to ask..
Edit2: The applet works now :)
Here is the solution for Mac OS, maybe it also works for Ubuntu.
How to solve 250, 500, 1000?
You should ask such questions only after the end of the Challenge Phase.
250: let's sort our bricks in nonincreasing order and let's put them in such a pattern (number is an index of the sorter array):
Any permutation of bricks 1-8, 9-10, 11-14, 15-16 will be fine.
500: already explained in Russian in this post.
UPD. I've changed the comment after eatmore has pointed to my error, but didn't mention it. Now everything is fine :).
Actually only wrong solution is explained in russian post.
Can't find correct solution of 500. Would you mind giving a link?
Comments down here :D
Not exactly right, two smallest bricks must be near the center.
Oh yes, I've drawn the diagram incorrectly, though my solution got AC.
Would you explain please, how have you found out such pattern for 250 problem ???
I tried with,
I thought it would give me max result... :(
But it hasn't worked... :(
Well, you've guessed that 8 highest bricks must be put in a checkerboard pattern. I don't really understand, what can be unclear after you've made this assumption: you put a brick into an empty position and you can easily write a formula of how it affects the answer (each brick now affects the answer independently).
I put 8 highest bricks in checkerboard pattern, but I have not followed any order. I've just put them in descending order. But you haven't done it.
And when putting rest 8 bricks, I've put them in ascending order...
But it didn't work... :(
So it comes in my mind that, there should be specific ordering for putting them. So I asked you if you followed the order... :(
*** Sorry for my bad english
You had a lot of time to read my comment again and again, again and again to finally notice that I've written: "Any permutation of bricks 1-8, 9-10, 11-14, 15-16 will be fine.".
What does it mean? It means exactly the following: you must(!!!) put the bricks exactly as I've done this, but the groups that I've mentioned can be permuted in any way. You can transform this to an answer to your question.
Competitive programming is an activity where participants must think heavily to achieve some result and I really hate people who don't do this and fill Codeforces with such garbage questions. As I've read my hint again, it's obvious for me that you didn't understand it not because of I've written it unclearly, but because of your blindness and lazyness.
Why are you so angry? Not everyone is as smart as you. Mukit09 is asking about solution and trying to understand why it works — it does not looks like laziness. That green guy just can't get it.
Mukit09, looking at your pattern, answer is S_total-4*(l[10]+l[15])-6*(l[9]+l[11]+l[14]+l[16])-8*(l[12]+l[13]). It should be clear that if you want to maximize answer, you should rearrange those bricks in such a way that you'll have S_total-4*(large_bricks)-6*(medium_bricks)-8*(small_bricks).
Thanks a lot I_love_Tanya_Romanova ... :)
Since I do participate in such discussions, I'm not smart, I'm an idiot. Really.
But why do you repeat Xellos's explanation? Mukit09 is green, but it shouldn't prevent him from scrolling the page down and reading another comment.
As I've told before, I'm not smart, but even for me it seems obvious that spoonfeeding won't help anybody to become smart either. IMHO, it will be much better if people such as Mukit09 will be angry with me, but this anger will make them grow hard and beat me and you and somebody much stronger than us sometimes.
But seems that I don't have enough authority to make people change their oppinions...
It is quite usual in normal society. Normally nobody has "authority" to force people think on one way or another.
250: The area is the sum of absolute values of height differences between all neighboring blocks. We can guess that it's best to use a chessboard coloring and put the larger 8 blocks on black squares and smaller ones on white squares. Then, we figure out that it's best to put the 2 smallest blocks in the 2 central white squares and blocks 7 and 8 to the corner white squares (to maximize the number of times larger h are added in abs(h-0)).
500: Bruteforce, sort the wolves by a and first try splitting the sequence into the prefix that goes left, suffix that goes right and center. If the wolves are in correct order now, it's easy to compute the cost; otherwise, center must be empty and you can choose the prefix (in sorted order by b) that will be left on the left (lol), count the number of wolves which need to pass through the passage (lol again) once more, and then count the distances. Time's probably something around O(N4).
Nice Observation of 250. I envy you to have such insight to solve problems as 250. Because after trying to use Dp to solve 250 the whole contest, I finally became green on TopCoder. TAT
250: "fair" solution would be submask dynamic: you just put elements one-by-one from the largest to the smallest and keep the mask of the occupied cells. If you put an element somewhere, you have to subtract its value * number of neighbouring cells in the mask (since it is smaller then values in these cells). However, everyone submitted the following greedy: put 8 smallest and 8 greatest values in chess-order, preferring central cells for the larger (smaller) numbers. Should be pretty straight-forward to prove, but I didn't do it during the contest (seemed pretty painful to strictly prove it).
500: There are 2 cases: either there is an element which was not both at the left end and at the right end (this case is trivial), or was there is not. If it was not, each element either came to some end and stayed there, or came to some end, then to the other, and stayed there. You can sort items by their final position, and then iterate through possible left-right splits, and then determine who has to also go to the other end for the split.
1000: DFS on states (tree edge, number of tokens in subtrees separated by that edge)
1000: Suppose we want to move the red tile from node a to node b. Let's freeze its movement in the middle of the edge (a, b). Note that at this moment both a and b are empty. Also, we know that there are k black tiles in the subtree of the node b and total - k in the subtree of a. Here the subtree of the node a is the connected component of a after removing the edge (a, b). Let's call three numbers (a, b, k) the state.
There are O(N2) states in total, because we have O(N) edges and O(N) possible values of K. Now we need to define transitions between these states. Before we start our movement from a to b we need to rearrange black tiles in the subtree of b in some way. Let's iterate over the node c that will be our next destination (after we reach b). We can iterate over all possible values of k', which is the number of black tiles in the subtree of c with respect to the edge (b, c). Note, that we can easily find the bounds of k'. In this way we can find all the states (b, c, k') that are reachable from (a, b, k).
Now we just need to do a bfs/dfs in this new graph, where the vertices correspond to our states. The complexity is O(N3).