| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
|
0
Nice solution :) Using |
|
0
Because b ≤ 108 |
|
0
Also wondering I tried to enumerate every pair of vertices (B, D) and calculate the number of diamonds (assuming these two are the middle vertices of a diamond). Intersecting their parents and their children, I obtained the number of possible vertices (A, C) that could form a diamond. Also intersecting these two sets, I obtained the number of "repeated" vertices that are both parents and children of A and B, and thus can't form a diamond with itself. And add to the answer the value (parents * children — their intersection). But this approach gave TLE |
|
0
Take a look at Timus online judge. You can filter the problems by DP tag and sort them by difficulty — link |
|
+1
Suppose that we have solved the first part by constructing the DP table for LCS. Now we can backtrack to obtain indices of common characters for both strings that form this LCS. Thus, we should calculate the number of shuffles for every substring between common LCS characters (ai... ai + 1) and (bi... bi + 1) — let's call them si and ti — and multiply the results. |
|
0
Could you please explain how we can fix one point if all of them probably were shuffled? |
|
0
I had an idea to calculate all pairwise distances for some fixed permutation (there are 28 segments in total) and sort them. Now, if first 12 of them are equal, next 12 are equal and last 4 are equal, it's a cube. But I didn't have time to code this solution and can't prove it |
|
+4
If this question is still open, a solution based on Aho-Corasic + DP is explained here — http://www.cprogramdevelop.com/2578501/ (there are also links to other related solutions on the same page) |
|
0
Are nonexistent infinity elements placed to the right/bottom edge of the tableau (since rows and columns are sorted); or they could appear anywhere in the matrix? |
|
0
Here's the code how this could be done using recursion with caching. But, you can't do it faster than the number of all possible combinations: |
|
0
Thank you for the link. Haven't found it, very interesting |
| Name |
|---|


