Hi there!
Today Tomorrow at 20:00 MSK will be held Topcoder SRM 677.
Let's discuss problems after contest.
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Hi there!
Today Tomorrow at 20:00 MSK will be held Topcoder SRM 677.
Let's discuss problems after contest.
Name |
---|
chrome is back !
Looking at the Topcoder Dashboard, it seems like Topcoder is making an attempt to improve user experience for good! The "Launch Arena" button also directly redirects to the web arena, instead of asking me to download an application.
Is it possible to use something like KawigiEdit in WebArena to generate C++ source stub with tests?
I am not sure if stable plugins are available for the Web Arena yet. This blogpost from Jan 2015 gives an impression that they're still testing some plugins.
The web arena is open-source and available on Github, if anyone wants to contribute. I think they have some support for calling arena functions to generate code skeletons in various languages.
EDIT: This commit (#c380ff) seems to have added support for the Web Arena Plugin API.
I didn't imply a plugin for Web Arena.
It would be enough for me to have any utility, which converts text problem statement into C++ source file template with class definition, tests and expected results check.
Bumping this, since it starts in about 12 hours from now.
I see. Your job here is to remind us about topcoder contests.
I can't open the Arena, anyone is experiencing the same issue?
If only topcoder contests were made on Codeforces platform
What about Web Arena? Did someone use in recent matches? Were any bugs?
This will be my first match on TopCoder. I have few doubts.
Will submission points decrease if my solution fails to compile or doesn't pass batch test?
If i don't submit any problem's code then also my rating will be affected?
How to do div1 500?
DP[v][i][j] — probability that diameter of subtree rooted at v will be i and longest path from v to leaf of this subtree will be j.
When you are merging two trees — you try both possible values for added edge; new deepest vertex is trivial, new diameter of subtree is either diameter of some of two old parts or path connecting deepest vertices in two parts (depending on which one is longer).
I coded this idea but I got TLE since it's 50*100^4 steps, do you merge dp[v][i][j] and dp[child][i][j] in faster than 100^4?
It's not more than 100^4. In fact constant behind it is also small. And I've just checked it in practice room, my solution runs in 0.005 seconds.
You only need to implement your knapsack in not-so-careless way. At least do all cycles up to largest possible value at this moment, not up to 100.
P.S. Actually I have no idea about number of reachable states here, maybe it works even in O(N^3), looking at running time of my code. However, for knapsack in general it will be N^4.
I don't know what do you mean by not-so-careless, and I'm doing cycles up to largest possible value, but it's still very big number 100^4 * 50 equal to 5 *10^9, so it's hard to pass even with a lot of constant optimization
here's my code http://pastebin.com/th0fb1KV which got TLE
Instead of bounding values for both subtrees by size1+size2 or max(size1,size2) (which obviously gives you N^5 on chain graph), you have to bound values for first subtree by size1 and values for second subtree by size2. Here is a code.
that magic
if (dp[v][i][j]>1e-20)
made my code very fast!!! but your code is fast even without it!I also had a bug that I am iterating to
mx[nd]*2
which can become 200 (note that in my code mx[nd] is already multiplied by 2) so I changed it tomin(100,mx[nd]*2)
I will look through your code to know why it's fast
thank you
by the way this solution doesn't have the official intended complexity!
Maintain another array depth[v]-maximum depth in subtree v.In DP[v][i][j] you can see that i can only go from depth[v] to min(depth[v]*4,2*(n-1)) and j go from depth[v] to 2*depth[v].So we can cut off many unused states.I got AC that way.
I did what you said, I got AC but it barely fit the TL (running time is 1.8 s) also I had a bug in my code which made it running more steps and even going outside array bound
thanks
First for each subtree and each d between 0 and n calculate probability that subtrees depth will be at most d. Then choose center of graph and length of diameter. There are 2 cases: center is on vertex, or center is on edge. In first case depth of tree should be half of diameter and there should be at least 2 subtrees with that depth. In second case each end of our edge should have fixed depth, which depends on the position of center on edge and edge length.
Where is instant post-match editorial when you need it the most? ;_;
How to solve div2 Hard ?
I had a weird DP solution for Div2 900
Let dp(i,j) denote the length of smallest palindromic path between node-i and node-j
Note that dp(i,j) = -1 if there is no pair (u,v) such that (u,i) and (v,j) are valid edges and label on (u,i) is equal to label on (v,j).
The base cases will be:
dp(i,j) = 0 if i==j (trivial)
dp(i,j) = 1 if (i,j) have an edge between them.
Now we can loop over all pairs (u,v) such that (u,i) and (v,j) are valid edges and label on (u,i) is equal to label on (v,j). Our answer for dp(i,j) will be 2+min(dp(u,v)) for all (u,v)
Our final answer will be dp(0,1). Sample Code: Link
I don't think it's a DP solution ! But the idea is really cool !
cgy4ever is the writer of this round. It seems he may be busy now, so I'll post solutions for him.
Here is code:
div2: http://pastebin.com/sgnpradR
div1: http://pastebin.com/PLHbRYF9
some hints:
In div1 med center is not necessarily on middle of an edge. It be on distance 0.5 from one end and 1.5 from the other end.
Oh sorry. I meant it's on an edge (though not exact center of the edge). Here's cgy4ever's solution based on this idea: http://pastebin.com/iRMnRCcF
Screencast