Блог пользователя dapingguo8

Автор dapingguo8, 5 месяцев назад, По-английски

We apologize for both the late editorial and the statement leaking issues. Unfortunately, as the problem authors, we never had any chances to prevent the leaking. Still, feel free to downvote if you have dissatisfaction due to these.

But what so ever, we hope you can enjoy the problems.

2216A - Course Wishes

Idea by Warriors_Cat

Solution
Code(C++)

2216B - THU Packing Puzzle

Idea by E.Space

Solution
Code(C++)

2215A - Interval Mod

Idea by Ecrade_

Solution
Code(C++)

2215B - RReeppeettiittiioonn

Idea by SpiritualKhorosho

Solution
Code(C++)

2215C - Oriented Journey

Idea by dapingguo8

Solution
Code(C++)

2215D - EXPloration, EXPloitation, and Gain Some EXPerience!

Idea by xiaoziyao

Solution
Code(C++)

2215E - Star Map

Idea by Kratrissa

Solution
Code(C++)

2215F - Research

Idea by E.Space

Solution
Code(C++)

2215G - Maze

Idea By crazy_sea

Solution
Code(C++)
  • Проголосовать: нравится
  • +80
  • Проголосовать: не нравится

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Ragebaitforces

»
5 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for the editorial. Pretty impressed by solution D, especially the last few lines were an eye-opener regarding the max distance to be considered and thus, the no. of masks.

During implementation, note that after making a move, the leading player might temporarily extend their lead to a distance of ⩾ 6. However, on the subsequent turn, they will either move back to reduce the gap, or the situation will naturally fall into the blocking case described above.

Great problemset indeed, unfortunate that it was an unrated contest. But it is something that the contest setters would find tough to control. Kudos!

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

1.I solved problem 1B in $$$O(d(n)+n^{1/3})$$$ on the contest, ignoring the condition $$$\sum n\le10^{12}$$$.
2.I thought that 1D/2F maybe the players won't be very far, but didn't notice that when dis>=6 A will get all of the score.
3.The problems 1D and 1E are so ad-hoc!!

»
5 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The F problem solution can be easier. You can use the Monotonic Stack. Just use two stacks, a monotonic increasing stack and a monotonic decreasing stack, it's easier than the solution in the editorial.

»
4 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem G, is there a more formal proof, or a more detailed proof?

  • »
    »
    4 месяца назад, скрыть # ^ |
    ← Rev. 6  
    Проголосовать: нравится 0 Проголосовать: не нравится

    I solved it in what I think is the intended way (by considering the projections and using 4 trees). Here is a more detailed and understandable proof/solution:

    Let $$$\mathbf{A}$$$ = minimum cost if we can move orthogonally with a cost of $$$1$$$ and diagonally with a cost of $$$2$$$ ($$$\mathbf{A}$$$ = the number of orthogonal moves, if an orthogonal path exists)

    Let $$$\mathbf{B}$$$ = minimum cost if we can move orthgonally or diagonally with a cost of $$$1$$$ ($$$\mathbf{B}$$$ = the number of chess king moves)

    Let $$$\mathbf{C}$$$ = minimum cost if we can move orthogonally with a cost of $$$2$$$ and diagonally with a cost of $$$3$$$ (the solution we are looking for)

    Then $$$\mathbf{A} + \mathbf{B} = \mathbf{C}$$$, since both $$$\mathbf{A}$$$'s and $$$\mathbf{B}$$$'s paths coincide with $$$\mathbf{C}$$$'s path. A proof of this fact can be derived from the statement in your comment: "It is optimal to visit the vertices (intervals) of this tree in order". This would also be the way to prove the intended solution's statement: we can replace $$$2, 3$$$ with $$$1, \sqrt{2}$$$.

    To compute $$$\mathbf{A}$$$, we construct 2 trees using the 8-neighbor relation (as you mentioned in your comment) and add up the lengths of the paths (one of the lengths is the x projection and the other is the y projection). (Note: If we had constructed the trees with the 4-neighbor relation, $$$\mathbf{A}$$$ would be the genuine orthogonal distance)

    To compute $$$\mathbf{B}$$$, we transform the grid with the matrix:

    $$$\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}$$$

    (This matrix does: 45 degree clockwise rotation, followed by a flip about the x axis and a scaling by $$$\sqrt{2}$$$.)

    Because 2 orthogonal moves in this transformed grid correspond to 1 (chess king) move in the original grid, we construct a simillar tree, only this time using only the 4-neighbor relation (to prevent diagonal moves). Then after querying the distance, we need to divide by 2.

    Here is my implementation: 377032285

    Edit: the complexity of this algorithm is $$$\mathcal{O}(X * log(X) + q * log(X))$$$, where $$$\mathbf{X} = \mathbf{m} + 4 * \mathbf{n}$$$ is the number of blocked cells

  • »
    »
    3 месяца назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Solution Explanation

    Observation 1

    First, let us assume that we are asked for the Euclidean distance (ignoring complexity for now). We note that the shortest path under the Euclidean metric is unique.

    An intuitive way to understand this is to imagine drilling a hole at the start and end points in the maze, then threading a string through these two holes, connecting the start and end points inside the maze. If we pull both ends of the string simultaneously, the resulting taut string corresponds exactly to the shortest path.

    Observation 2

    Under an affine transformation, the Euclidean shortest path maps to the Euclidean shortest path of the transformed maze.

    Formally, let $$$F$$$ be a linear coordinate transformation, let $$$M$$$ be the corresponding maze with its start and end points, and let $$$S(M)$$$ denote the shape of the Euclidean shortest path in $$$M$$$. Then we have

    $$$ F(M(S)) = M(F(S)). $$$

    The same physical string model can be used to understand this property.

    Observation 3

    In fact, the query can be interpreted as the Manhattan distance plus the Chebyshev distance between the start and end points.

    If we take the grid to the infinitesimal limit, the shape of the Manhattan shortest path and the shape of the Chebyshev shortest path both coincide with the shape of the Euclidean shortest path.

    Algorithm

    Therefore, we can directly compute the shortest distances along projections in four directions (vertical, horizontal, and the two diagonal directions), multiply each by the corresponding coefficient, and sum them up.

    To compute the shortest path along one projection direction (take the vertical direction as an example), we can treat each maximal vertical segment without obstacles as a single node. The resulting graph then becomes a tree. Hence, the bottleneck of the algorithm is locating which node each point belongs to and computing LCA (Lowest Common Ancestor) queries.

    The reference implementation uses Heavy-Light Decomposition (HLD) for LCA queries. It runs in approximately 0.5 seconds, and the code length is about 4 KB.

»
4 месяца назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

Problem G.

I solved it. However, I was not able to intuitively understand the editorial well, nor was I able to prove it properly. So, for anyone who may feel similarly, I will briefly write down my solution.


Consider $$$O(n+m)$$$ intervals of the form $$$[x,x] \times [y_1,y_2]$$$, and build a tree using the 8-neighbor relation. It is optimal to visit the vertices (intervals) of this tree in order. This can be shown by considering the shortest distance between two points within the same vertex.

First, there is an $$$O(\text{path length})$$$ solution. We move through the vertices one by one while updating a function $$$dp_v(y)$$$. The update of $$$dp_v(y)$$$ can be expressed as a min-plus convolution with a function $$$[\ldots,9,7,5,3,2,3,5,7,9,\ldots]$$$, together with a restriction of the domain.

From this, we can see that $$$dp_v(y)$$$ is a convex function whose slopes consist of $$$-2,-1,0,1,2$$$. Therefore, $$$dp_v(y)$$$ can be described by four integers representing the "slope-change points", together with its minimum value.

These four types of slope-change points can be handled independently. The computation along a tree path can be aggregated by composing functions consisting of operations such as add, chmax, and chmin.

The minimum value of the dp function can also be decomposed into separate computations for each of the four types of slope-change points. Adding a contribution whenever a slope-change point on the negative-slope side is affected by chmin, or a slope-change point on the positive-slope side is affected by chmax.

In the end, the problem decomposes into four computations of the following type along a tree path: repeatedly apply add, chmax, and chmin, and compute the total amount moved by the chmax and chmin operations. This is a well-known type of problem that can be handled by a segment tree or similar data structure, since it forms a monoid.

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

why if cT>cU+2cH, not just cT>cU?

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can anyone explain how Question INTERVAL MOD solution works fine ?

like let we got the that segment which causes min penalty ,now what we are doing ?

setting that interval first and then expanding left and right or first expanding left and right and then setting the interval in the last ,

how we are doing this ?

»
3 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think yours 2216A little bit complicated here

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The first one ain't 900 bro, at least 1100

  • »
    »
    2 дня назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    or even 1300 because, i have solved 1500 rated problems and they are so easy compared to this