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

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

Привет! В 13.08.2024 17:40 (Московское время) начнётся Codeforces Round 966 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6-8 задач, которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов, после её завершения все успешные попытки будут перетестированы на успешных взломах. Мы постарались сделать приличные тесты — так же как и вы, мы будем расстроены, если у многих будут падать решения после окончания контеста.

Вам будет предложено 6-8 задач и 2 часа 15 минут на их решение.

Штраф за неверную попытку в этом раунде будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в пяти рейтинговых раундах (и решить в каждом из них хотя бы одну задачу)
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Задачи были придуманы и написаны нашей командой: myav, Gornak40, ibraevdmitriy и Vladosiya.

Также большое спасибо:

  1. MikeMirzayanov за помощь с идеями и системы Polygon и Codeforces.

  2. FairyWinx, TheScrasse, Be_dos за красное тестирование раунда.

  3. irkstepanov, Kirkon, ikrpprppp, Kaey, Bruteforceman за жёлтое тестирование раунда.

  4. Vitaly239239, FBI за фиолетовое тестирование раунда.

  5. satyam343, vikram108 за синее тестирование раунда.

  6. trgt26 за зелёное тестирование раунда.

Всем удачи!

UPD: Разбор опубликован.

  • Проголосовать: нравится
  • +232
  • Проголосовать: не нравится

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

only purple and yellow testing?

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

Me waiting to get a minus again lol .... I dont know why i underperform div 3 and div 4 . Anyways can some one tell me any practice method to master div 2 D , i hardly able to solve them within 3 hrs in practice session .

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

Expect to solve at least 4

Hope to solve at least 5 and get 1250+ rating

UPD: Solved ABCDE

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

I wish I can AK this round >_<

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

I am waiting for the tester to comment on this blog.

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

More people created problems than tested them :O

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

No one for testing CYAN :(

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

I hope this contest to be cheating free.

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

Wish I can get Expert on this contest!

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

lol guys you probably need some more testers)

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

contest no.2000!

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

don't know but the performance in div 2 is better than div 3, hope to reach expert in this div 3

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

hope for Asuna_Yuuki

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

As a participant, DangKhoizzzz orz__

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

OMG! Another Vladosiya round !

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

wapis blue banna hai mujhe.. (hopefully)

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

2000th Contest! It seems that Goodbye 2024 can't be contest No.2024......

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

As a tester, I wish you would enjoy the contest

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

I will full solve this round, ggez

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

Satyam is definitely not blue testing, lmao

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

satyam343 should not be allowed to do BLUE testing.

He is fake blue, he is actually Red.

That's like Donald Trump representing Poor of America.

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

Contest #2000 on Codeforces! What a milestone

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

Hope to solve 5 problems today. Good luck everyone!

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

Here we go to Chess.com :D

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

Thousands of submissions for E in the last 20 minutes wow

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

Great contest! Good problems for a div 3

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

why am I reading the comments instead of solving E o.O

I still have 20 minutes left

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

stuck at F for an hour :) . Also 600 submissions on F in last 12 minutes? Yeah seems legit

Great Contest though , enjoyed :)

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

Well this round feels like true Div 3.
Good balanced contest.

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

Nice contest, but cheaters ruined it again

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

I can't find any counter example for my submission in D : 276247102

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

Whosoever tranlated the problem statement or created it, better don't please. E was awful like awful!

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

Got H last minute, phew. Feeling a little bit lucky.

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

H : Ksyusha and the Loaded Set can be solved using the tricks introduced in problem G: Penacony from last Div 3 Round. I talk more about the trick and the data structures used in this video

Define $$$dp[x]$$$ to be the longest streak of missing numbers starting at $$$x$$$. If a number is present in the set, you set $$$dp[x]$$$ to $$$0$$$. Otherwise, $$$dp[x] = 1 + dp[x + 1]$$$. Hence, you can populate this DP right to left after reading the initial numbers.

To answer any query, you just need to find the first $$$x$$$ such that $$$dp[x] \geq k$$$.

When you add an element, you need to refresh the DP table to the left of $$$x$$$. You can iterate over each element, and check if $$$dp[i] \gt |x - i|$$$. If it is, you need to subtract $$$dp[x]$$$ from all such $$$i$$$. Finally, set $$$dp[x] = 0$$$.

When you remove an element, you again need to refresh the DP table to the left of $$$x$$$. You set $$$dp[x] = dp[x + 1]$$$. Then, for each element to the left, check if $$$x$$$ was a bottleneck for the streak, i.e, if $$$dp[i] == |x - i|$$$. If it is, you increment $$$dp[i]$$$ by $$$dp[x]$$$.

Code for $$$O(N^2)$$$.

Now, to optimize it to $$$\mathcal{O}(n \cdot log^2(n))$$$, we need to figure out how to refresh the DP table efficiently. First, notice that $$$dp$$$ values of missing streak would decrease by 1 each step until it falls to 0 and then it starts at a big number and keeps falling. Hence, in type 1 and type 2 queries, when we say that we need to refresh the DP table to the left, we only have to refresh the elements after the last $$$0$$$. Hence, we need a data structure that can efficiently :

  1. Find out the location of the last zero.
  2. Add a delta in a range.
  3. Query maxima

Sadly, no such data structures exist. But we faced this same issue in G: Penacony from last Div 3 Round. Notice that 0 is always a minima. Hence, we can binary search on the left, and keep discarding one half of the range if the minima of that range is 0. Hence, a lazy segment tree from Atcoder Library suffices, usage of which I have discussed in the video above.

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

    On second thought, you don't even need to query min/max using Lazy segtree. The last $$$x$$$ where $$$dp[x] = 0$$$ would simply be determined by finding the upper bound of existing elements and looking to the left. Hence, you just need a segment tree to do range increments and range maxima. So overall time complexity becomes $$$O(N \cdot log(N))$$$.

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

    I used a segtree to maintain the longest missing segment on a range. You'll need to additionally store range length, longest missing prefix and suffix: 276231982. Finding the first missing segment of length $$$k$$$ corresponds to binary earching on a segtree, which atcoder library conveniently provides in $$$O(\log n)$$$.

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

      For me, I saw that we need to find the minimum number $$$x$$$ in the current set such that the difference between $$$x$$$ with its right element is strictly greater than $$$k$$$. The answer is $$$x + 1$$$. I used a segment tree with minimum query to find such $$$x$$$. 276290172

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

Any hints on F?

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

    DP

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

    Calculate the costs of increasing a point by 1 in each rectangle for all n + m axes. It is min(dim(x), dim(y)) at each turn.

    Then do a simple dp iterating on 'i'th rectangle, solving for 'j' points and taking 'x' first axes from the 'i'th rectangle

    Submission for reference

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

    For a given rectangle find the minimum number of cells to paint to achieve a gain of $$$t$$$ points. $$$t \leq k$$$. To compute this , you will paint cells in a way so that first $$$a$$$ rows are first $$$b$$$ columns are painted so that $$$a + b = t$$$. Note that minimum cells = $$$ n * b + m * a - a * b$$$ where $$$n$$$ is number of rows and $$$m$$$ is columns. After that this problem is similar to knapsack.

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

    Do DP

    with states taking the first i rectangles and getting atleast j points then check for minimum among all possibilities of taking x rows and y columns and reduce time by adding the check that $$$x+y \leq k$$$

    the number of operations performed is simply $$$x*b + y*a - x*y$$$

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

Will greedy not work on F (greedily sort by a*b) ? Or if it works do we need to handle last rectangle case differently?

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

F: Thought greedy at first, but sample proved otherwise. Realized K was extremely small, and it's obvious that the answer will be deterministic from pos, k. Then just DP on that, taking the smaller of the rows or columns when you decrement k for each rectangle.

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

I was 10 minute too late for submitting E... feelsbadman

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

Wow I mean solving ABCD as a newbie and still get a negative delta

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

This was a fun round! Got stuck on F for a long time, I wrote dp that stored the fewest moves required for the current rectangle index and current score, but one test case gave an incorrect answer and I couldn't figure out why: 276291118

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

    Figured out the problem, I was getting 86 instead of 80, because I fixed the row and column sizes for every score for the rectangle. For example, for 2 points I would fill a 3x3 rectangle with 3+3 operations, when it could be colored with 3+2, since 3x3 becomes 3x2 after the first operation. Worked perfectly after accounting for this

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

Why this code (https://mirror.codeforces.com/contest/2000/submission/276250584) for problem D failed on test case 7?
Any counter test case?

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

for G, l did binary search + dp approach and l am in doubt about the correctness, pls hack my solution if you can, thx! submission link

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

Good contest, I just performed really badly cause I couldn't figure out some edge case on D :(

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

my idea for F is
we can pick a greedily pick a rectangle whose one of the dimension is minimum across all $$$(ai, bi)$$$
suppose $$$ai$$$ is minimums we add $$$ai$$$ to our cost and and get 1 point and decrease other dimension by 1
$$$cost \ += \ ai$$$
$$$k \ -= \ 1$$$
$$$bi \ -= \ 1$$$
but it's giving 36 instead of 35 for last tc

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

Please help me find out why submission 276251214 in C++17 (GCC 7-32) Runtime Error but same code submission in C++20 (GCC 13-64) Accepted?

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

I couldn't even understand sample test cases on problem F

wtf

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

Can someone please explain me the 6th sample testcase for problem F.

Sample input :

3 25 9 2 4 3 8 10

Sample Output : 80

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

This contest was fun, I solved ABCD within around 1 hour, and I solved E with 10 minutes left. Hope to get 1250+ rating!

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

Imagine D without the last case it would be so much fun pain

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

Still a very great contest. Appreciated the problems with good enough difficulty. Thanks a lot to the authors and tester

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

wow! so many people had the same idea for e! and the same code too!

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

    its most likely cheaters, 5000 solved E in a div 3 isnt normal

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

    I do think E have some dp trick or math trick, it should be a quick one for experienced players (but not me tho, E cost me 1.5hrs rofl)

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

      2d prefix sum :P

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

      2D differance array.

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

      idk how you did, but essentially for any cell, you can very easily calculate in how many subsquares its gonna appear, and if you just put all of that in an array and sort it in descending order, you can sort the heights in descending order as well, and then multiply biggest height with biggest multiplier, 2nd biggest with 2nd biggest etc..

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

        can easily calculate in how many subsquares its gonna appear

        Any hints on how to calculate this? I was trying to derive a formula but failed ;-;

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

          You can calculate how many subsquares will contain a cell by calculating the minimum and maximum possible x and y for the top left square of a subsquare of size k by k by that contains that cell . If you need more hints I can help you.

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

            yes please, for topX = max(0, i-k+1) and topY = max(0, j-k+1) but not able to understand how to find bottom one

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

              Both your minX and minY are correct. For the maxX and maxY, there are two things bounding it: i and j, and the distance from the edge of the grid. So maxX = min(i,n-k) and maxY = min(j,m-k).

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

          well you can see that in best case scenario it would be K*K, and in the worst case scenario(if its a corner cell) its 1*1. you can also see that the cell thats in the center always has the max possible multiplier, while the ones that are closer to the edges gradually decrease. consider that, and try to derive a formula from there

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

          An alternate solution that I feel is simple is that if you take it to one dimension, in each row now its no longer a k sided square but a window of size k that moves along the array you can increment the starting positions of the windows and decrement their ends, so you can iterate over every cell, say its at index i, and if i + k < columns, then you can increment arr(i) and decrement arr(i+k), and if i + k == columns, then only increment arr(i) because you dont need to close off the window from the right (it will be after the array’s end), and after youre done you iterate over this array and calculate the prefix sum array, and this will make the values at each cell represent the number of windows that cover it Do this for a grid over all rows, then do this same thing but on a different grid over all columns, and then multiply the values in the corresponding cells, and this value represents how many K sided squares will cover this cell

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

        I had this same idea but it felt too brute force (that it would not pass the time limit) so I didn’t try it.

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

Amazing contest! Problems were true Div3 rated.

Thanks a lot for the round myav Gornak40 ibraevdmitriy Vladosiya and all testers!

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

I hope to become specialist in this round but chances of drop are high too at 5k rank

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

    Please add "By cheating" also in this comment lol.

    https://mirror.codeforces.com/contest/2000/submission/276270036 https://mirror.codeforces.com/contest/2000/submission/276291750

    Your last Div 2 's C was also copied from telegram/YT isnt ?

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

      Nope it wasn't coz the code here is quite short. So similarities are natural. Additionally, the variables used are also directly picked from the question. If I copied from yt/telegram I would have solved till G. Nor would I have submitted this late.

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

        So you wanted me to make a dedicated blog ?

        btw you are atleast brave(or maybe stupid enough?) to cheat that casually and have your name , college name etc .

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

          Having my name, college name etc is enough of an evidence that I won't do anything that stupid on a website that's public and doesn't erase past records and shows your code to everyone. Although I can say look at my submission map, problems solved, submission time of codes etc, I won't and will try to be objective here.

          1. For small codes, we can't really figure out if someone has cheated because ideas are likely to be the same all over.
          1. You might notice a difference in coding style of both the links. Now consider the two possibilities here — assuming that I cheated, I could have done 2 things —

          a) Copy the code as it is. This clearly ain't the case because the two codes in the link you gave have different structures (the second being my signature style that might be verified by checking my previous submissions)

          b) So this brings us to the second case — I did minor changes (not the gpt ones like variable change). So I was smart enough to manually type the code in my coding structure but not smart enough to change the variables? Wouldn't I try to make them as different as possible from the original source I am copying from if I already took the burden of doing the hard part ie restructuring it? And about the similar variable names, as I said they are the standard ones I normally use (check some of my past subs like using cnt for count to save time) and the rest being picked from problem itself.

          1. The coding style of the code you shared seems radically different to mine (infact idk fs what ll means maybe coz I never had the need to use it) so in that case I wouldn't have removed it had I copied it from here since idk what it does and how removing it would effect my program (but would give you a benefit of doubt for this one since I can't prove that idk what ll is xD).

          Now with all due respect I'd request you to please reply a strong counter to it OBJECTIVELY without assumptions or in case you do have to make them, make it statistical enough to have a high probability of occurrence with (preferably) quoting data.

          Additionally, your profile is quite new, created just at the time you replied to my comment which hints at the sole purpose of replying to me as the purpose of its creation (maybe because you yourself are a cheater who is scared of being caught had you come from a real account? Maybe someone who actually copied from the source you mentioned?) But anyways I won't make wild assumptions like that but this but the part of you creating this account just for the purpose of making this comment is a fact as it can be cross checked from the time frames there above mentioned. Idk what's the intent behind it but fs there is something you are scared of for which you didn't reply with your real acc.

          Additionally, I'd take the part of you pointing out specifically at my profile picture and me mentioning the name of my college as a try to create pressure via blackmailing (cyberbully in simple words) so would henceforth request MikeMirzayanov to check it out (and also manually review my code and the one stated above to crosscheck and ask for further clarifications if needed).

          I do get people getting pissed off from cheating but there is a clear difference between asking for clarification politely and attacking someone directly with giving threats in response restorting to cyberbullying. Creating a fake account just for the purpose of doing so further adds suspicion for it being done for a malicious intent.

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

            That "infact idk fs what ll means maybe coz I never had the need to use it" is kinda sus though

            Are you saying that you don't know what "long long" is? You literally have a #define int long long in your code so you should know that #define ll long long also does the same thing, using a shorter name for the type

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

              Actually I have been coding in a standard template since the start of my cp journey so always used int for long long (except in initial days when I worked in C). Not much idea about macros except how they work. And that other code used 2 different macros for long long so idk of that or how the two are different

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

                I have two questions for you:

                1. Why you used global array in 276291750 and 276236011 where as you mostly used vector (local vector) like you used in this 275625615?
                2. Why you delete some of your code from your template in Solution E?

                PS: I'm not accusing anything here; I'm just genuinely curious.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  20 месяцев назад, скрыть # ^ |
                  Rev. 4  
                  Проголосовать: нравится -13 Проголосовать: не нравится
                  1. Declaring an array locally may exceed the size limit since it is stored in a stack in C++. How did I know it is the particular case? By testing it and failing twice (mle is a pain to debug coz cph doesn't show any output. Nor codeium explains it in most cases)

                  PS — Using extensions like cph and codeium arent against the rules afaik.

                  In fact you might try giving it a shot yourself. If you use VS Code, just copy paste my code there and cut that array declaration part from the global scope and paste it in local scope. The program will likely crash. I do use local arrays but it isnt really a good practice to do so (i am just habituated) because it can lead to issues like this where your program just crashes abruptly and you might not be able to figure out why it went wrong.

                  1. Now coming to the deleted code part, well in one of the attempts of correcting the code when I was selecting to erase my code (the previously written code) parts of my template was also selected and got deleted. Yeah i could have done Ctrl+Z but there were like 5 mins on the clock, i was kinda panicked and then it clicked why the program might have crashed (global array issue. i knew this because it happened before once in one of the problems of binary search on answer recently of spoj called paul's conjecture) so i just started typing not caring of whats lost (some got auto generated my codeium, an extension installed on my vs code which sort of remembers your previous code and makes typing quick) and as you can see i made my submission in the last minute with 10 secs left on timer.

                  but why did i use a static array in the 1st place when i normally use a vector? well i use vectors most of the times but not all the times. you can say i sort of switch between arrays and vectors (favoring vectors more though xD) but i do use arrays in some cases like you might see my solution to B in this contest where i used an array instead of vector to store boolean values. And you cant say that code is copied because i even saw the solutions of various PCD channels and none used the particular approach which I used for B so it is in a way unique (not the best though)

                  EDIT — AND YES SINCE YOU BROUGHT IN THE ARRAY PART I NOTICED JUST NOW THAT ARRAYS ARE ALSO DECLARED DIFFERENTLY. IN THE LEAK CODE THE ARRAY IS DECLARED BY KEEPING A CONST CALLED M. THAT AINT THE STYLE I USE IF YOU LOOK AT MY OLD TEMPLATES I HAVE ALWAYS USED MINIMAL CONSTS ONLY FOR THINGS LIKE INF AND MOD. ALSO, THE VALUE OF DECLARING ARRAY IS DIFFERENT IN THE SOURCE COUDE IT IS 1E5+7 AND IN MINE IT IS 1000000 BECAUSE I (AND NATURALLY ANYONE UNLESS A SPECIAL CASE NORMALLY DECLARES ARRAYS IN POWERS OF 10). THAT SERVES AS ANOTHER TESTIMONIAL FOR THE ORGANIC NATURE OF MY CODE!!!

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

                  Why did you get mad at the end? I mean tbh the guy is not even wrong. I've seen several people with the same exact code as yours and the same exact definition of the global array and etc... So how come that the 3 codes the guy pointed out at all have similarity with other people? Or do you call that a "coincidence"?

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

                  @vjudge for the similarities in the code as my first comment says, it is clearly possible with a really good probability because the length of the code is fairly short. For a 8-10 line code it is impossible to have significant differences because the logic is pretty much straight forward. Now I am no where claiming E was an easy problem. But sometimes hard problems are straight too it's just that they are hard because you take time to figure out the chain of thoughts. Try to compare problem As you might find many people having similar codes because in small codes it is impossible to spot much differences.

                  For the global array part, as I stated in another of my comments, it is because of the nature of the problem. You are a newbie so you might not know (no offense even I came to know of it a few weeks back at pupil) that using a local array sometimes gives MLE that crashes your program and this is the case here so using a global array becomes evident.

                  And for many people having same codes for global array declaration, maybe you are right I didn't do a research on similar codes to the one this guy sent and it might be true it was leaked (but again we can't figure it out as this code is short) but even it's the case, my array declaration is different from the one he shared. There's no similarity between the two and they are radically different for using both different techniques and values as far as the given code is concerned. The first code declares a constant M with a values and uses that to declare the array. That's a technique I have never used and even in my submission I have declared the array directly. Also, check out the value of const in the array in the code above and compare it with the value in mine. Even they both are different. So how in any way is global array declaration same in both of these?

                  EDIT — And I didn't really get mad at the end I got panicked which any one does when time is running out. The ones who don't are extremely calm people and they are exceptions

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

Did anyone else use DSU for problem C lol?

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

someone hack my F, its O(n * k^3) 276277213

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

During contest, in problem E, I could only see green and yellow cells in the test sample. Was it only my problem?

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

Fun fact: among the 7 "trusted" participants who solved all the problems, almost half of them are being untrustworthy, rank 4,5,6 submitted the same code except that they changed the variable names.

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

Don't know why the last sample of G is 2 for quite a while until I see During the phone call, you cannot ride the bus, but you can walk along any streets, make stops , or stay at home.

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

276274588 and 276288231 LMAOOO, how does this not get caught in plag checks?

Another one 276288851

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

Many submissions for problem F contain this strange block of code, and now they're receiving WA hacks.

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

why greedy dont works for F? If sort pairs {min(a,b), max(a, b)}, fill that smallest side, +1 point for smallest side, in moment that will be square and thats anyway easiest way to got +1 point

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

    must use dp

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

    explain please how to get 35 in last test case

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

Hackforces

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

About problem F,why so many people define the size of a three-dimensional array as 40*70*70276276544 276285014 276272465 276274621 276287283 276287474 276279626 276276752

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

Enjoyed the Round!! Thanks

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

Loved the round. Will be one of my fav cf rounds. Great algorithmic problems. Truly Loved it.

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

Truly beautiful problem F. Spent the whole contest on it and could only upsolve it. It truly made my day, thank you myav, Gornak40, ibraevdmitriy and Vladosiya!!

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

Hint for D:

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

GOT wrong answer in problem A because the input included spaces!

I got a runtime error in Problem A of this contest because one of the test cases was "10 " (10 with a space). is this intended ?

I couldn't see how the problem description explains this?

but overall the contest was great!! would appreciate it if someone can clarify the situation with problem A

Thanks!

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

    It is not necessary intended, but in general you should write code that allows extra spaces, tabs, etc unless statement clearly states about exact gaps. I.e. "integers in lines are separated by a single space".

    The only reason tests are not always being checked on such formatting is because code that fails on them is usually bad code.

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

    When using input = sys.stdin.readline you always get an \n at the end. When using int() or .split() this gets dropped, but for strings it stays there. You can see this if you do print(list(input())).

    To avoid this you can just do: input = lambda: sys.stdin.readline().rstrip()

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

Having the discussion stream start before the open hacking phase ends feels wrong. But I guess most people don't hack anyways.

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

Wasted 20mints in F implementing Binary Search :(

BTW problems were good tbh :p

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

Problem C, States that the value of m<=10^5 and n<=10^5 and t<=10^4, the time limit is 2seconds, then how is the solution of O(t*m*n) being accepted??

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

how to solve the problem E?

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

    The limits on N*M <= 200,000 means you can traverse the grid.

    Traversing the grid lets you calculate how many sub-rectangles would contain each position.

    Thus you assign the larges values to the position repeated most

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

Where's the editorial.. why they have not uploded it yet :(

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

https://mirror.codeforces.com/contest/2000/submission/276288423

Can anyone enlighten me as to why this doesn't work?

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

any one solve problem F in greedy and priority ? I debugged according to this idea, but did not pass,and I just want to know whether this idea is legal ?

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

the statements of problems is not clear i take long time to understand it, and i miss some to get

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

Can someone explain me why this code for H is giving TLE.

For every segment which is not present in the array, I am storing its size and the index where the segment begins from. I am storing the best (minimum index) in an array and building a minimum query segment tree on it, and I am also storing all other indexes in a set corresponding to its segment size to handle the '-' and '+' queries later.

Next, for each '+ x' or '- x' query, I am updating the segment tree and the map according to the new segments formed and unformed. Here, I am doing insertions and deletions on sets whose complexity is O(logn) time. And for the '?' query, we need a segment of size atleast k and with minimum index, which I am finding using the segment tree, which should be O(logn).

So, the overall time complexity of my code should not be worse than O(nlogn + qlogn).

Sorry, if someone is going through my ridiculously chaotic code.

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

Why can the same code be Accepted in Java 21, but result in Time Limit Exceeded (TLE) in Java 8?

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

In Problem E, why can the same code be Accepted in Java 21, but result in Time Limit Exceeded (TLE) in Java 8?

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

Why didn't I get a rating after this contest?

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

Can E be solved when the constraints of n and m are order of 10^9 ?

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

I'm trying to upsolve the Problem D — Right Left Wrong. Problem is my submission 276359457 is giving TLE while a similar logic, but one using 1-based indexing is getting accepted and I'm unable to understand how. 276137058

Can someone please help me understanding why it might be the case.

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

    in your code, findRangeSum() is O(r — l + 1) for range [l, r] while the latter code uses prefix sum to provide O(1) lookup

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

      Hi Towley. Thanks for taking out the time to check my submission. But I too have used prefix sum to find out the range sum.

      int findRangeSum(vi sum, int l, int r){
          int ans = sum[r];
          if(l > 0){
              ans -= sum[l-1];
          }
          return ans;
      }
      int _find(vi &arr, string &str){
          vi cSum = arr;
          for(int i=1; i<n; i++){
              cSum[i] += cSum[i-1];
          }
       ......
       ......
          ans += findRangeSum(cSum, i, j);
      
      }
      

      Would be great if you or somebody can take another look at it. This is really driving me crazy.

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

        this is because you're passing vector as a whole, instead of as a reference in findRangeSum, which creates a new vector hence it'll take O(n) instead of O(1)

»
20 месяцев назад, скрыть # |
Rev. 6  
Проголосовать: нравится +9 Проголосовать: не нравится

A not so elegant brute force solution also exists for problem G.

We can run a Dijkstra from the nth intersection (Using only bus service). After the Dijkstra calculates the minimum distance to all the intersections, we take those intersections which are at a distance <= (t0 - t2). This ensures that we are not using bus services during our phone call. From these selected intersections, we can run a multisource Dijkstra (This time we can only walk through the routes). We repeat the same process of selecting some specific nodes, and then run a third Dijkstra which corresponds to the bus route taken before the phone call.

My implementation breaks the above scenario into two cases. Case 1: We use the bus service first, then we walk along a route, and then we again use a bus service. Case 2: We use the bus service first, then we walk along a route. However a clever implementation won't require us to do so.

Link to Implementation: 276362277

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

can some pls tell me why my code for D fails?

276271810

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

Is this rated , if yes then why doesn't it shows on my profile btw this was my first contest . Does anyone know about this

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

See #4, #5, #6 in the official list:

276286062 276283663 276290958

276277048 276273889 276281919

The cheating is getting out of control, becoming too widespread, and taking the fun out of participating in these contests. Anyone found cheating should not just be skipped for that contest but be life banned from this platform. If that is too harsh, at the very least, put their rating to 0, and let them start again. The current system is too lenient and encourages cheating.

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

Why do man people make comments about cheaters Who could explain that to me?Thanks!

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

    Because Codeforces had an enormous increase in cheating in the last few months, so much so that nowadays there are up to a few thousand cheaters per round. Also, some people are cheating all the way up to International Master.

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

So happy. I will be blue after this contest

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

Just wandering about problem E if there is a better way of calculating how many times subsquares overlap in a cell that runs faster than O(n*m). Was thinking of simply calculating how many cells that are covered by x subsquares exist but I dont know if its possible. Also whats the name of this concept (wandering since Ive encountered similar problems on math competitions, and had to compute them by hand)

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

why Time Limit Exceeded 276190376

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

Sadly, I failed to write a good "key not in the map" check in C and got hacked, but during the upsolving, I came up with a rather elegant way of circumventing the failure: check out the code — I use a wrapper struct to define a default int value: 276398448.

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

    Kinda nuts it wasn't in a pretest, but hard to blame someone other than myself (my solution was hacked too). I think it's possible to just add 1E9 + 1 to received number.

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

    I mean a .find() function exists though...In C++20 there is also a .contains() function

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

      In this particular case it would be much less elegant and had to be put in several areas of code which would make it harder to comprehend.

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

        Uhhh, that I don't know, I used .find() and I don't think it's less "elegant" than writing a new wrapper struct or something

        This is that part of my code

        auto it = atos.find(a[i]);
        if (it != atos.end() && it->second != s[i]) {
            return false;
        }
        
        auto it2 = stoa.find(s[i]);
        if (it2 != stoa.end() && it2->second != a[i]) {
            return false;
        }
        
        atos[a[i]] = s[i];
        stoa[s[i]] = a[i];
        
»
20 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I got runtime error, probably because I am uncorrectly wrote condition when string size is not equal to array size (276152133). But there is a test in the samples which have a string shorter than array size, but my solution passed it. Why?

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

When will ratings get published?

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

Anyone else getting runtime error on testcase 16 in D problem after system testing

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

Vladosiya, 276250408 During contest, I submitted this code and got runtime error with exit code -1073741819, and just now, I submitted the EXACT SAME CODE, 276428579 and it got accepted. Please help

edit: later it got same runtime error again T_T

but not on the same test case as earlier. This time it makes sense because of out of bounds, but how come it earlier fail on test 15 and now it passes it?

Can someone please tell me what is that error code and why does it randomly occur at any time?

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

where is editorial??

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

Could you please tell me why I was hacked in question C? I think my time complexity is in line with the regulations, it should be O(n * m * logn), where n * m <= 2e5. Here's my answer: https://mirror.codeforces.com/contest/2000/submission/276152431

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

Why are submissions being picked randomly from the queue?

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

In problem C only lowercase latin letter are allowed, why exact same solution that uses unordered_map works, while original one with vector doesn't?

Edit; I forgot that elements of the array can be -1.

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

Can anyone help me understand why it is throwing TLE?

https://mirror.codeforces.com/contest/2000/submission/276439386

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

I want to go back to Newbie...

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

You don't need to learn Segment Tree to solve H, here's my submission 276496494 that runs in 1200ms :)

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

In problem B "Seating in a Bus", whenever I try to run individual test case, it is giving me desired answer but when i run all test case, it is failing in the last testcase.Can someone point out when i am making mistake-276490271 Thanks!!

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

    out of bounds access. first of all, you should seat[i]--; since your array is 0 indexed and the input is 1 indexed, and then for seat[i]=0 or n-1, make edge case checks. (or make a 1 indexed array with 1 extra space to the right so you dont have to make those ifs).

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

What is the 2.4065th testcase in E problem or whats wrong in this solution? https://mirror.codeforces.com/contest/2000/submission/276969819