| # | 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 |
|
On
skywalkert →
2018-2019 ACM-ICPC, Asia Nanjing Regional Contest (Online Mirror on Gym), 8 years ago
+10
I got AC :) https://codeforces.me/gym/101981/submission/46396181 But I think most of you cannot see my submission right? |
|
On
skywalkert →
2018-2019 ACM-ICPC, Asia Nanjing Regional Contest (Online Mirror on Gym), 8 years ago
+10
Thank you for the clear explanation! During the contest, I reached the final part but didn't come up with the way of judging it in O(n·polylog(n)). With your idea I think I may have found a bit easier way of solving this: First, as you said, if the length of the price tag is odd and the numbers of each digit(i.e. 0, 1, 2) satisfy a kind of triangle inequality, then we can eliminate all of the other digits except one digit. Actually this implies the answer must be lower than 2 under such circumstances(this is what the triangle inequality says). So what we are interested in is only whether the answer can be 0(otherwise the answer should be 1). For each digit, let c0, c1, c2 be the number of occurrences of 0, 1, 2 in the left side of the digit respectively(because we can easily calculate the conditions for the right side, we don't care about it). Then, again from the triangle inequality, in order to keep some digit till the end, three inequalities c0 + c1 ≥ c2, c2 + c0 ≥ c1, c1 + c2 ≥ c0 must hold. However, actually we don't have to care about the last inequality because it would be preferable if some 0s are left over. Therefore after each query we only have to judge whether there is at least one '0' digit that satisfies c0 ≥ abs(c2 - c1). This can be checked with 2 segment trees. Both of segment trees should support Range Maximum Query with Range Update. One of them maintains the value c0 - (c2 - c1) while the other one does c0 - (c1 - c2). The elements should be sorted in the order of c2 - c1. This order can be calculated in advance and won't change. During each query, we can check if the maximum values of those segment trees(in the appropriate range) are non-negative. After that we can just update those segment trees with Range Update. I just came up with this solution so I don't test this solution yet. I'll update this comment if I get AC or notice I am wrong :) |
|
On
skywalkert →
2018-2019 ACM-ICPC, Asia Nanjing Regional Contest (Online Mirror on Gym), 8 years ago
0
Would someone explain the solution for H(Nanjing)? |
|
+11
In the final part of F, you can use std::sort like this: This decreases the complexity of fixing the order to |
| Name |
|---|


