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

Автор ilyakrasnovv, 21 месяц назад, По-русски

Привет, Сodeforces!

Мы очень благодарны Вам за участие в нашем раунде.

Спасибо Qwerty1232 за помощь при написании разбора.

1715A - Хмурогруз

Совет #0
Подсказка #1
Подсказка #2
Подсказка #3
Решение

1715B - Красивый массив

Подсказка #1
Подсказка #2
Подсказка #3
Решение

1715C - Моноблок

Подсказка #1
Подсказка #2
Подсказка #3
Решение

1715D - 2+ стула

Подсказка #1
Подсказка #2
Подсказка #3
Решение

1715E - Долгий путь домой

Подсказка 1
Подсказка 2
Подсказка 3
Решение

1715F - Квадраты на полях

Совет #0
Подсказка #1
Подсказка #2
Подсказка #3
Решение
Разбор задач Codeforces Round 816 (Div. 2)
  • Проголосовать: нравится
  • +204
  • Проголосовать: не нравится

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

TLE on D T.T

»
19 месяцев назад, # |
  Проголосовать: нравится -35 Проголосовать: не нравится

Trash contest

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

Wow, such a fast tutorial!

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

One of the best C

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

Thanks for the really nice contest and also the editorial:)

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

Though I couldn't perform as well as I expected, the contest and the problems were interesting :)

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

I think convex hull trick is too complicated for div2 E, please don't add such tasks

  • »
    »
    19 месяцев назад, # ^ |
      Проголосовать: нравится +76 Проголосовать: не нравится

    You can also do it with D&C dp, I think this was a nice question. You learn these tricks but there aren't many "easy" questions on them because they are generally reserved for harder problems with more observation. This was a simple application and personally I got a nice Aha moment when realising I could use D&C, imo this way you get a chance to build an intuition for them

  • »
    »
    19 месяцев назад, # ^ |
      Проголосовать: нравится +24 Проголосовать: не нравится

    my hands finally knows about CHT by this task

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

You can also solve E using Divide and Conquer DP because of the square cost function

My submission

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

    can you elaborate on the divide and conquer dp?

    • »
      »
      »
      19 месяцев назад, # ^ |
        Проголосовать: нравится +8 Проголосовать: не нравится

      The objective of the D&C was to calculate the minimum distance after a flight(assuming the flight just landed at some point), so you have a set of distances you got from dijkstra in $$$dp$$$_$$$old$$$, then you calculate post flight distance for $$$i$$$, aka $$$dp$$$_$$$new[i]$$$ as $$$min_j (dp$$$_$$$old[j] + (i-j)^2) $$$

      I divided this up into two parts
      $$$min_{j<i} (dp$$$_$$$old[j] + (i-j)^2)$$$
      $$$min_{j>i} (dp$$$_$$$old[j] + (i-j)^2)$$$

      Both of these are what I solved using D&C DP, followed by more Dijkstra to calculate travel via roads

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

        nice get the divide and conquer now,

        using the optimal to cut up the array was cool wouldn't have thought of that

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

        Can you elaborate how to solve one of those partial minimums? I was able to do that only with some crazy math.

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

          Let $$$opt[i]$$$ be the index $$$j, j<i$$$ which gave the minimum value of $$$dp[j] + (i-j)^2$$$, then Divide and Conquer DP works iff $$$x < y$$$ implies that $$$opt[x] < opt[y]$$$, which you can see is the case here with some light maths. What you do is, if you want to calculate $$$dp[l]$$$ to $$$dp[r]$$$, let $$$mid$$$ be the middle point, you calculate $$$dp[mid]$$$ and $$$opt[mid]$$$ in $$$O(r-l)$$$, and once you calculate $$$opt[mid]$$$, it reduces the range you need to search for the rest of the elements, then you recursively do this calculate $$$dp[mid]$$$ and $$$opt[mid]$$$ for the segments that are left and right of $$$mid$$$.

          This was very brief but you can read more about Divide and Conquer DP here

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

Can someone explain the Convex Hull Trick mentioned in E? I can't figure a way to calculate the minimum for each node without iterating over all other nodes to get $$$d_{new}[v]$$$

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

    Its a somewhat advanced DP optimisation trick that allows you to optimise dp of the type $$$dp[i] = max_{j<i} dp[j] + cost(j, i)$$$ from $$$O(n^2)$$$ to $$$O(n log(n))$$$ by looking at each of the previously computed DP values as lines with decreasing slopes. You can find tutorial videos online, this is where I personally learned it

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

    You can also use Li Chao tree (it is just advanced segment tree) Both are data structures that allows you to find minimum/maximum of linear functions' values in O(log(n))

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится +40 Проголосовать: не нравится

For D, another solution is to simply build the answer from left to right, choosing the minimum value of $$$a_i$$$ each time.

To do this, first we need to restrict which bit of each $$$a_i$$$ can be $$$1$$$. This can easily be done by looping through all the condition $$$(i, j, x)$$$:

  • If the $$$k$$$-th bit is $$$0$$$ in $$$x$$$, then it must be $$$0$$$ in both $$$a_i$$$ and $$$a_j$$$.

Let call $$$allowed_i$$$ the number that has all allowed 1-bit of $$$a_i$$$, then we can see that $$$a_i = allowed_i$$$ is a solution to the conditions, and for all solution, $$$a_i$$$ is a submask of $$$allowed_i$$$.

Then we can loop from $$$1$$$ to $$$n$$$ and construct $$$a_i$$$.

For $$$a_1$$$, we want to make it as small as possible, which mean we want each bit to be $$$0$$$, if possible. We can loop through all the condition $$$(1, j, x)$$$ to check which bit of $$$a_1$$$ must be $$$1$$$. Simply, if a bit is $$$1$$$ in $$$x$$$, but $$$0$$$ in $$$allowed_j$$$, then that bit must be $$$1$$$ in $$$a_1$$$.

It's easy to see that after this process, the best $$$a_1$$$ is just all the forced bits. We can then loop over the conditions $$$(1, j, x)$$$ and force the $$$1$$$ bits on $$$a_j$$$. Just repeat this to get the answer.

You can see my implementation here: 169201529. (Please excuse the weird syntax, I'm experimenting with it).

My implementation is $$$O(n + mlog(m))$$$ due to sorting the initial conditions, but $$$O(n + m)$$$ is achievable as we can do the work for all bits at once in this solution.

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

Hello! Could you please tell the reason for contest extended? As for me, nothing was wrong, so I'm just curious. Thanks!

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

    During contest many contestants expirienced issues with Bad Gateway

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

мы не можем найти лексикографически меньшее решение глобально. Тут наверное "не" лишнее.

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

In problem C, Can Somebody explain why to add number of segments in initial answer? i.e After adding the number of subsegments, we get the answer: 6⋅72=21,21+14=35.

  • »
    »
    19 месяцев назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    consider any subarray with no joints ,the answer will be one; if there are x joints in a subarray, the beauty value is actually x+1; so the number 21 that you see is actually number of segments when we consider them without joints and the we add 14 to compensate for all the joints that could be considered;

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

    Video Solution for Problem C and Problem D.

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

Hello, Can someone please explain why this failed (Problem B)? 169134990

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

    Your solution failed because: 1. The lower bound for s would be b * k (handled properly) 2. The upper bound for s would be b * k + n * (k — 1) (your code does not handle this properly).

    As, after setting first element to b * k, you can still add k — 1 to each element of the array.

    Counter Test Case: 1 2 3 1 6

    Correct Answer: (5, 1) or (4, 2) Your Code output: -1

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

Hi, anybody can explain, why my solution is wrong? WA test 4 https://codeforces.com/contest/1715/submission/169168903

  • »
    »
    19 месяцев назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Hi! It seems like you forgot that if the ith bit of (a | b) is equal to 0, then the ith bits of both a and b must be equal to zero.

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

An alternative randomized solution for Problem F:

Disclaimer: My solution fails on test 65, but I think it is probably an implementation error. Please correct me if this solution is just completely wrong.

The basic idea is to draw a lot of rectangles of the width of the field. Draw the first one at $$$y=0$$$ with height $$$1 \cdot \varepsilon$$$. Draw the next one at $$$y=1 + \varepsilon$$$ with height $$$2 \cdot \varepsilon$$$, and so on, each one exactly $$$1$$$ apart and $$$1 \cdot \varepsilon$$$ taller. We choose $$$\varepsilon$$$ as a very small number.

Since we have to draw one polygon we can just connect all rectangles on one side.

The square can only intersect one rectangle since they are each $$$1$$$ apart. We don't want any rectangle to only partially intersect with the square, so we offset everything by a random number between 0 and 1. This makes a partial intersection very unlikely since the height of our rectangles is very small.

With the answer to our query we can determine which rectangle the square intersects with and we know the $$$y$$$-coordinate is within the interval $$$[y_{rectangle}-1, y_{rectangle}]$$$. To determine the exact coordinate we can just query this interval and calculate $$$y$$$ with the intersection area.

We can repeat this for $$$x$$$ to get the answer in $$$2+2=4$$$ queries.

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

    My solution is similar to yours. But I chose to randomly set a small value for the width of each rectangle, and fixed the interval between each rectangle to 1.

    It passed all the test points. Here it is.169490864

    I'm so sorry that I am poor in English.

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

Can anybody tell why my solution for D doesn't pass? It has same complexity. O((n + m) * log(x)).

Here is solution: 169156511

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

    I have not gone through your code, but I can tell you the Test case where it fails Counter Test Case: 2 2 1 2 7 2 2 6

    Correct Answer: 1 6 Your code output: 0 6

    I hope this would help you :)

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

В задаче С если ее делать на питоне, в претесте 2 есть тест который выдает TL на абсолютно верный код в котором ввод делается через input(), если считывать через sys.stdin.readline(), то тест проходится. Кто нибудь подскажет это можно как то отаппелировать? А то выглядит как вполне себе некорректный тест и обидно жесть как, 1.5 часа на задачу потратил. К слову все решения этой задачи на питоне сделаны только через sys.stdin.readline()

Вот пруфы: неверное решение с input(): https://codeforces.com/contest/1715/submission/169157450 такое же но с sys.stdin.readline(): https://codeforces.com/contest/1715/submission/169171912

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

    Тест корректный. А стандартный ввод в питоне медленный. Интересующее вас явление можно найти в интернете по запросу "fast io python". Вот пример одной из неплохих статей, которые можно найти вышеописанным способом: https://www.geeksforgeeks.org/python-input-methods-competitive-programming/ sys.stdin.readline() действительно является более быстрым способом считывания, поэтому ваш код и стал проходить.

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

The evolution of $$$Div2$$$ $$$E$$$

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

can someone tell the rating of the C problem ?

  • »
    »
    19 месяцев назад, # ^ |
      Проголосовать: нравится +6 Проголосовать: не нравится

    I guess somewhere around 1700...

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

      ok thanks, it is harder than the usual Div2 C problems

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

        Agree.I felt the same XD

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

        I think C was reasonable for Div 2 since the only major (intellectually) hard part was figuring out how to compute the cost at the start. Transitions between queries were really simple (albeit long) and didn't require much thinking.

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

Oh no! I realized the solution of prob.F during the contest, but is only cost 2 operations, so i didn't dare to write it :(

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

Oh no! I got the solution of F during the contest, but it only cost 2 steps.So I didn't dare to write:(

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

Спасибо за отличный раунд! Последняя задача очень понравилась.

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится +24 Проголосовать: не нравится

A solution I thought of for E was to use a segment tree, what you would do is take the old distance and add $$$i^2$$$ to each $$$a_i$$$, doing that and taking the minimum of the array gives the answer for $$$i = 0$$$, then for moving forward from $$$i-1$$$ to $$$i$$$, you add the AP -1,-3,-5.. To the suffix and ...5,3,1 to the prefix — essentially adjusting the square terms we added. For this we of course need a segment tree that can add an AP to a range and take the minimum of all elements, can anyone confirm if that's possible? If it is can you point me to some resource?

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
»
19 месяцев назад, # |
Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

D does not require any graph theory knowledge at all.

Initially, there are $$$30n$$$ unknown bits.

We can do a first pass over the queries to find all bits $$$p$$$ and $$$q$$$ such that $$$p \mid q = 0$$$, which means $$$p = q = 0$$$. These are the only bits that must be 0 in order to satisfy the statements (you can hypothetically set all remaining bits to 1 and this will satisfy the statements, but likely will not be lexicographically least).

Then we can do a second pass over the queries to find all bits $$$p$$$ such that $$$p \mid 0 = 1$$$ or $$$p \mid p = 1$$$, which means $$$p = 1$$$. The former can arise due to forced 0 bits from the first pass, while the latter can arise from statements where $$$i = j$$$. These are the only bits that must be 1 in order to satisfy the constraints (though you can't simply turn all remaining bits into 0 this time, since our remaining equations have the form $$$p \mid q = 1$$$).

With the fixed bits out of the way, we can greedily clear all non-fixed bits of $$$a_1$$$ to 0. If any of these bits were involved in an equation of the form $$$p \mid q = 1$$$, then the other bit in the equation becomes fixed to 1 to satisfy it. We can then repeat for $$$a_2$$$ and so on.

Runtime: $$$O(m + n)$$$, with a constant 30 iterations for everything.

My Submission: 169185957 (I checked for $$$i = j$$$ and $$$p \mid q = 0$$$ while reading the statements)

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится -62 Проголосовать: не нравится

E is trash

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

About C, It confuses me that where n*(n+1)/2(in the tutorial is 6*7/2)comes from?

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

    In my opinion, it is easier to have an initial array filled with the same number. The initial answer is $$$n \cdot (n+1)/2$$$ since that is the number of subarrays, and each subarray will have an awesomeness of 1. After that, we only have to know how to handle the changes after each operation.

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

when i looked at my submission after contest, i was surprised when i saw wrong answer Statement not true: (i, j, x) = (78387, 31267, 38016256)

after that i used assert to check if the limit on every bit is satisfied. to my surprise, the assert doesn't happen.

can anyone tell me why? the submission id is 169192815

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

    There are $$$q$$$ statements, but your solution reads $$$n$$$ statements only.

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

In problem E, could anyone explain the Dijkstra part mentioned in the editorial? How to transfer from "ending with air travel" to "ending with a usual edge"?

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

    My solution of E:

    Let's just use Dijkstra algorithm with only roads. Now repeat next thing k times:

    For each v:

    dp[new_layer][v] = min(dp[previous_layer][v], minimum_of(cost_of_flight + dp[previous_layer][from]))

    Run Dijkstra on updated distances

    Answer for vertex i after k repeats is dp[k][i]

    Submission using Li Chao tree for finding minimum_of(): 169168040

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

      What does it mean to "Run Dijkstra on updated distances"?

      How is it different from normal Dijkstra?

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

        It is not any different. You have some precounted distances, use them instead of INF you use usually and run usual Dijkstra

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

Great contest! I like A,C and F personally.

»
19 месяцев назад, # |
  Проголосовать: нравится -25 Проголосовать: не нравится

The system tests of problem D are too weak. Will it be retested?

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

I used a slightly different approach to D that didn't require a seperate pass for each bit:

  • Create a weighted graph
  • For each vertex AND together the weights of all its neighbouring edges. This tells you what bits can be set for that vertex. Call this the available value for the vertex.
  • Now go through the vertexes in order. If a vertex is its own neighbour then that gives you its value. Otherwise, OR together values for each edge:
    • If the edge goes to a lower numbered vertex, include those bits that are required by the edge but are not included in the solution for the other vertex. This can be calculated as (Edge weight) AND NOT (Other vertex value)
    • If the edge goes to a higher numbered vertex, include those bits that are required by the edge but are not available for the other vertex. This can be calculated as (Edge Weight) AND NOT (Other vertex available value)

This gives each vertex its smallest possible value subject to the values given to previous vertexes, so gives the lexically smallest possible sequence of values.

See my solution 169149168

I think one could create a similar solution without creating a graph by doing two passes through the data, which might be more efficient.

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

    My last comment is wrong. On the second pass one needs to go through the array values (vertexes) in order, and to know the final values of all lower numbered adjacent vertexes before calculating the value of current vertex, so this needs full adjacency information (i.e a graph).

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

"С" прикольная задача, но я не понимаю, как у решивших вообще появилась такая идея решения? Что их сподвигло на конкретно это решение? Объяснение понять-то не так просто, а кто-то смог это ещё и придумать.

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

The time complexity between 169232632 and 169236193 is the same. The only difference is I scanned in increasing order instead of decreasing order. I wonder whether it is a trick to cut down time.

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

This solution is easy for problem A.

»
19 месяцев назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

In problem E,

I'm facing a weird issue, when I initialize the distance to all the arrays with >= 1e14, it gives WA on test case = 37, otherwise, it passed all the test cases.

https://codeforces.com/contest/1715/submission/169246634

https://codeforces.com/contest/1715/submission/169246972

Can someone help me?

All that I'm changing between the two submissions is for(int i=2;i<=n;i++) dist[i] = ll(1e14);

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

    [Removed, as it was an in invalid test case].

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

      The test you provided isn't valid because $$$k$$$ must be at least $$$1$$$. In fact, when $$$k$$$ is at least $$$1$$$, taking a direct flight from $$$1$$$ to $$$n$$$ is always an option, so the answer is bounded by $$$(n - 1)^2 < 10^{10}$$$.

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

    My guess is that you overflow in your HullDynamic class. ks and bs can both overflow int, and so multiplication might overflow long long:

    (x->b - y->b) * (z->m - y->m)

    UPD: Changed long longs to int128 in your HullDynamic class, AC now: 169286182

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

Why in authors code of C.Monoblock, they used (n — (i + 1) + 1) instead of (n-i)? As both will give same answer. Why to use (n — (i + 1) + 1). (In for loop)

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

What's that in C++ code for E?

for (int i = 0; i < k; ++i) {
        for (int i = 1; i < n; ++i) {
        }
        for (int i = 0; i < n; ++i) {
        }
    }
»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone help me find out why my solution didn't pass for D ?

Here's my solution: for each index 1<= i <=n, let's find the bits that must be set to zero. Now let's iterate over the array starting from the last element, for each element we will only consider the statement that include another element with smaller index. For each statement that include that element, let's set to 1 all of the bits that are set to 1 in the OR value and can be set to 1 in the current index, the other bits will be set to 1 in the other element since we can't set them in the current one.

Here is a link to my submission: https://codeforces.com/contest/1715/submission/169171341

Any help will be more than appreciated.

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

Problem F: Life will be harder if the query polygon must have all of its points lying inside the field. (This is the problem statement came from my misunderstood :)).

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

rockstar_an is the best, thanks to him I'm an Expert.

PS : He is my dad :)

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

Problem F is brilliant! Liked it very much :)

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

Can anyone help me find out why my solution didn't pass for D ?

I think I have written as what have been talked in blog. I have tried to fix it, but I failed.

My submission:169346279

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

I disagree with Advice #0. You should always consider risk of wasting time on implementation of solution. And thinking about proof and trying to prove may save you from that.

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

For those who 1715E - Long Way Home for some reason don't understand why this thing can be applied here: within min first square component may be considered as parameter and second square term can be extracted from min because it's being constant in query.

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

Could anyone help me find why this submission https://codeforces.com/contest/1715/submission/169450718 which is O(32(m+n)) gets TLE but https://codeforces.com/contest/1715/submission/169452067 which could be O(32 * 32(m+n)) passes? The only difference is that I changed from a two-dimension vector to one-dimension vector, where bit information are added in edges instead of one-bit-one-graph. I have been thinking for the whole night. Thx...

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

In author solution for problem E why is it: while (ll.size() >= 2 && l.intersect(ll[ll.size() — 2]) <= x.back())

and not: while (ll.size() >= 2 && l.intersect(ll[ll.size() — 2]) >= x.back())

won't the authors solution remove lines from the Convex Hull that actualy need to be in it.

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

Interestingly, D has similar idea to https://codeforces.com/problemset/problem/1594/D, but you have to do it 30 times

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

I solved problem C with segtree
https://codeforces.com/contest/1715/submission/215391566
I solved a harder problem actually, I can query any segment and find its required value.

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

    There is a small typo in your template, it's "WEIRD" not "WIERD". Please fix it as it might cause denial of judgement verdicts.

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

Can someone help with C, I can't understand the explanation of how we count the sum of beauties of subarrays(answer) using this "the sum of beauties over subsegments is equal to the sum over all joints of the number of subsegments containing a particular joint, plus the number of all subsegments." Why does it work?