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

Автор Vladosiya, история, 47 часов назад, По-русски

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Всем удачи!

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

»
47 часов назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится
»
47 часов назад, # |
  Проголосовать: нравится -38 Проголосовать: не нравится

only purple and yellow testing?

»
46 часов назад, # |
  Проголосовать: нравится +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 .

»
46 часов назад, # |
Rev. 4   Проголосовать: нравится -8 Проголосовать: не нравится

Expect to solve at least 4

Hope to solve at least 5 and get 1250+ rating

UPD: Solved ABCDE

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

    Good Luck

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

    NOICE

    • »
      »
      »
      17 часов назад, # ^ |
      Rev. 2   Проголосовать: нравится -8 Проголосовать: не нравится

      thx, I solved E with 10 mins left, which I'm really happy about.

      I tried upsolving F and I failed, so this is probably the best I could have done.

      I always seem to underperform Div.2 and Div.2+Div.1 and overperform Div.3 and Div.4

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

        Im glad to hear that you've done it:) Guess you would be really happy then.

        I was solving F for about 40 minutes, but it was hard in implementation + because of sleepiness (It was about 2 a.m. in my time). So I solved only ABCDE too.

        I guess both you and I could prepare Div2 and later by solving some Div2 problems from the problemset prior to the contest.

        GL to you for this one. Hope you could promote back to pupil!

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

          well i think in this round G is easier than F. during the contest i have no idea of how to solve F as greedy wont work and i was shocked when i saw most people use DP to solve...

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

    NOICE, dude!

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

    how so pro?

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

    congrats to solve ABCDE

»
46 часов назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

I wish I can AK this round >_<

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

Hopefully I will reach expert in this round... :)__

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

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

»
45 часов назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

More people created problems than tested them :O

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

hope to reach pupil in this contest :D

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

No one for testing CYAN :(

»
43 часа назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

I hope this contest to be cheating free.

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

last contest before school starts :(

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

welcome a new -100 in rate (¬_¬)

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

welcome a new -100 (¬_¬)

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

Wish I can get Expert on this contest!

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

lol guys you probably need some more testers)

»
38 часов назад, # |
  Проголосовать: нравится +26 Проголосовать: не нравится

contest no.2000!

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

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

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

    same with me also may be i think more cheater in div 3 than div 2 because of hard question codeforces should find some permanent solution from this

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

Potato potato

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

hope for Asuna_Yuuki

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

As a participant, DangKhoizzzz orz__

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

OMG! Another Vladosiya round !

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

wapis blue banna hai mujhe.. (hopefully)

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

Hoping to break the 1400 barrier and becoming specialist this contest! Wishing everyone goodluck!

»
32 часа назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

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

As a tester, I wish you would enjoy the contest

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

I will full solve this round, ggez

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

Let's make the "As I am not a Tester .. " comment common.

»
31 час назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Satyam is definitely not blue testing, lmao

»
30 часов назад, # |
  Проголосовать: нравится +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.

»
29 часов назад, # |
  Проголосовать: нравится -11 Проголосовать: не нравится

It's better find another blue tester , satyam343 is actually red

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

Contest #2000 on Codeforces! What a milestone

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

Hope to solve 5 problems today. Good luck everyone!

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

I hope through this game, I can reach the Specialist

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

2000th CF Contest yay. Would be great if i somehow manage to become specialist.

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

Hope to reach 1300+ rating in this round

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

Here we go to Chess.com :D

»
25 часов назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Thousands of submissions for E in the last 20 minutes wow

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

Great contest! Good problems for a div 3

»
25 часов назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

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

I still have 20 minutes left

»
24 часа назад, # |
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 :)

»
24 часа назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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

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

Nice contest, but cheaters ruined it again

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

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

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

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

»
24 часа назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

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

Finally I solved 4 problems

»
24 часа назад, # |
  Проголосовать: нравится +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] > |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.

  • »
    »
    24 часа назад, # ^ |
      Проголосовать: нравится 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))$$$.

  • »
    »
    24 часа назад, # ^ |
      Проголосовать: нравится 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)$$$.

    • »
      »
      »
      24 часа назад, # ^ |
        Проголосовать: нравится +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

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

Any hints on F?

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

    DP

  • »
    »
    24 часа назад, # ^ |
    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

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

      Do you try to think of the problem first in a recursive way and then try to optimize it using DP, or you are able to think of the DP solution right away? If yes, how?

  • »
    »
    24 часа назад, # ^ |
      Проголосовать: нравится +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$$$

»
24 часа назад, # |
  Проголосовать: нравится 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?

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

    No, because k can be really small and you can have a big a*b, and a small a*b, but to get k, the smaller a*b can be completed in less moves.

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

      Can you explain a little more please, still not clear to me. Thanks

      • »
        »
        »
        »
        8 часов назад, # ^ |
        Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

        The person above didn't clearly explain their greedy strategy. There are many greedy variations that get WA, so if you have a concrete greedy strategy I can try to come up with a countercase.

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

          I always take the rectangle with smallest side (lets say a, b where a<b), now the cost of increasing points by 1 is a (Since I'll fill all the squares along the side a). Once I perform this operation my sides become a, b-1. I insert { min(a,b-1), max(a,b-1) } back in my multiset unless a and b both are zero.

»
24 часа назад, # |
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
  • »
    »
    6 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Can you pls check where am i going wrong in my implementation. Thanks!

    Code
»
24 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Stuck on E since I could not figure the amount of times each point will be contained in a sub-square. But overall, really nice contest.

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

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

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

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

»
24 часа назад, # |
  Проголосовать: нравится 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

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

    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

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

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

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

    Need to use long for prefix sum array

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

    You have declared prefixsum to be of type int, but with n = 2e5 and ai <= 1e5, prefixsum can exceed INT_MAX and cause an overflow.

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

      Yeah realised just now after seeing the failed test case, when i got 2 WA then i left the contest thinking if this is not correct then i cannot think another now, now i regret :(

      Just a silly mistake, how dumb i am :(

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

        use #define int long long

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

          Will it be a nice practice to use long long instead of int everywhere? Is there any cons doing that?

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

            It will be a little bit slower and use more memory, however it is extremely unlikely that you will TLE or MLE because of that.

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

            never found tle or mle so can use. at worst only mle not tle

»
24 часа назад, # |
  Проголосовать: нравится +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

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

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

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

    Your solution is correct,but In this line of your code score += mult[i] * nums[i] both mult[i] and nums[i] are integer so their product is also integer,you should declare nums and mult by long long integer.

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

      Oh my goodness, thank you!! For some reason I thought that 2e10 would fit in an integer data type but it doesn't. Thanks again! :)

»
24 часа назад, # |
  Проголосовать: нравится +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

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

    It is to be solved using knapsack.

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

    Did you find how for last TC, 35 is the answer instead of 36?

    I tried similar approach where I tried to get 18 points by filling 6X2 and 8X3, or is there any simpler test case that shows that it can't be solved greedily?

»
24 часа назад, # |
  Проголосовать: нравится 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?

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

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

wtf

»
24 часа назад, # |
  Проголосовать: нравится 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

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

    I didn't submit it because I was getting 86 here no matter how I tweaked. I cannot manually find a solution with 80 pixels too.

    Edit: Just figured it out. On the 8x10 tile you can score 7 for cost of 50 pixels like this: https://dl.unicontsoft.com/upload/pix/ss_problem_f.png

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

    Take 9 2 for cost of 18 and points equal to 11. Then 4 3 for a cost of 18+12=30 and points equal to 11+7=18. After that, every time add min(a,b) to the operation and points increase by 1. Also, subtract 1 from max(a,b) until points are greater than or equal to k.

    Though for this problem greedy will failed( i guess).

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

how did so many people solve ABCD wtf?

»
24 часа назад, # |
  Проголосовать: нравится 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!

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

    Indeed it was fun, even I submit E 10 minutes later I still feel very enjoyable.

    Coding until the last minute

»
24 часа назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

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

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

My dp shows what I am feeling like. Missed an overflow leading to wrong answer and all this while i was thinking why can't I find an edge case. F.

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

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

»
24 часа назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

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

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

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

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

    Yeah, I was shocked by how many people solved E.

  • »
    »
    24 часа назад, # ^ |
      Проголосовать: нравится 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)

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

      2d prefix sum :P

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

      2D differance array.

    • »
      »
      »
      23 часа назад, # ^ |
        Проголосовать: нравится +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..

      • »
        »
        »
        »
        23 часа назад, # ^ |
          Проголосовать: нравится 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 ;-;

        • »
          »
          »
          »
          »
          23 часа назад, # ^ |
          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.

          • »
            »
            »
            »
            »
            »
            23 часа назад, # ^ |
              Проголосовать: нравится 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

            • »
              »
              »
              »
              »
              »
              »
              23 часа назад, # ^ |
                Проголосовать: нравится 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).

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

            Ah yeah that does make sense. I think I have an idea on how to approach it now

            Thanks, I'll try solving it myself later.

        • »
          »
          »
          »
          »
          23 часа назад, # ^ |
            Проголосовать: нравится 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

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

            Yep I noticed that while writing it down but couldn't generalize it, it's fine I think I'll sleep on it and try it later. Thanks for reply btw

        • »
          »
          »
          »
          »
          19 часов назад, # ^ |
          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

      • »
        »
        »
        »
        12 часов назад, # ^ |
          Проголосовать: нравится 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.

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

Amazing contest! Problems were true Div3 rated.

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

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

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

  • »
    »
    23 часа назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится

    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 ?

    • »
      »
      »
      22 часа назад, # ^ |
        Проголосовать: нравится -14 Проголосовать: не нравится

      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.

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

        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 .

        • »
          »
          »
          »
          »
          21 час назад, # ^ |
            Проголосовать: нравится -14 Проголосовать: не нравится

          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.

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

            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

            • »
              »
              »
              »
              »
              »
              »
              19 часов назад, # ^ |
                Проголосовать: нравится -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

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

                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.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  17 часов назад, # ^ |
                  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!!!

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

Did anyone else use DSU for problem C lol?

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

    I didnt use but i realy thinking about dsu , but i realize that a div3 C must be something eazy

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

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

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

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

»
24 часа назад, # |
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.

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

    The 'trusted participant' thing is there to prevent alts conquering the scoreboard. It can't do anything against cheats.

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

How to solve D , getting wrong answer on second test case.

»
24 часа назад, # |
  Проголосовать: нравится 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.

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

    Can u please reiterate what u said? if we start at t=2, 2nd and 4th city will have their timestamps as 3 and 5 resp and we have to attend phone call for duration 5-7, so how are we able to cross to 5th city in <= t0?

    I am sorry, I am dumb, I just saw that phone call is only for the duration 5-6. So we can wait at 4th city.

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

    can you explain, why the sample testcase 1 answer is 0. I think we can wait upto 19 minutes and then take the bus route 1 — 5 which will cost 30 minutes, and we will arrive on 5 at 49 minutes ?

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

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

Another one 276288851

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

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

Spoiler
»
24 часа назад, # |
  Проголосовать: нравится +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

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

    must use dp

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

    explain please how to get 35 in last test case

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

      coloring all cells of 5 x 4 and 6 x 2 rectangles would give you 9 and 8 points costing you 20, 12 operations.

      now color one row of 8 x 3 rectangle, you get 1 point at a cost of 3 operations.

    • »
      »
      »
      23 часа назад, # ^ |
        Проголосовать: нравится +29 Проголосовать: не нравится

      Sure, here you go!

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

Hackforces

»
24 часа назад, # |
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

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

Enjoyed the Round!! Thanks

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

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

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

    ABCDE is good, probably comeback for FGH tomorrow. There's so many positive comments on them I will try to upsolve them for 1-2 days.

»
23 часа назад, # |
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, senjougaharin and Vladosiya!!

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

Hint for D:

Hint
»
23 часа назад, # |
  Проголосовать: нравится 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.

  • »
    »
    19 часов назад, # ^ |
      Проголосовать: нравится +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()

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

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

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

Wasted 20mints in F implementing Binary Search :(

BTW problems were good tbh :p

»
22 часа назад, # |
  Проголосовать: нравится 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??

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

    It is guaranteed that the sum of n across all test cases does not exceed 2⋅10^5 , and that the **sum of the lengths of all strings does not exceed 2⋅10^5** .

  • »
    »
    22 часа назад, # ^ |
      Проголосовать: нравится -6 Проголосовать: не нравится

    Those'll get hacked. Just wait!

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

how to solve the problem E?

  • »
    »
    22 часа назад, # ^ |
      Проголосовать: нравится +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

»
22 часа назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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

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

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

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

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

    Consider $$$n = m = 100$$$, and $$$k = n - 1$$$. This way not so many squares will fit in the rectangle, so for, say, $$$i, j = 50$$$ the count is incorrect.

»
21 час назад, # |
  Проголосовать: нравится 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 ?

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

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

»
19 часов назад, # |
  Проголосовать: нравится 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.

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

    Your create a $$$2 \cdot 10^6$$$ element vector for every test case, and there're $$$10^4$$$ cases, which are obviously too many.

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

    I came up with the same logic. Carelessly, not paying attention for the high constant factor. I tried the same logic with coordinate compression technique, and now waiting for the endless system testing and queue :<

    P.S it got Accepted

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

Ok am getting my first negative rating after this

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

rip my dp skill T-T

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

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

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

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

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

how solutions with O(n*k*100*100) passes in F?

»
12 часов назад, # |
  Проголосовать: нравится +14 Проголосовать: не нравится
»
11 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

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

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

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

    I believe atleast a traversal of N*m is required so, it wont really be possible in my opinion.

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

    I do believe it can be solved with some math magic... which will bring this E to at least G-H level (waiting for editorial to show us the math magic)

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

When will the ratings be published?

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

I solved 3 problems but why I don't have a rating? I'm a newbie.

»
11 часов назад, # |
  Проголосовать: нравится 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.

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

    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

    • »
      »
      »
      12 минут назад, # ^ |
        Проголосовать: нравится +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.

      • »
        »
        »
        »
        6 минут назад, # ^ |
          Проголосовать: нравится 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)

»
10 часов назад, # |
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

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

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

276271810

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

    For your B submission you put an if statement specifically for cases when n = 1 or n = 2, this is fine, but what's wrong is that you are putting it before you take the next input which is the array of passenger, so for example if the case were like this:

    2

    1

    1

    3

    3 1 2

    It should output "YES" for the first and "NO" for the second, but since the first have n = 1, you printed "YES" before actually taking the next 1, so for the second one you take that n = 1 (and printed "YES" again) when it should've been n = 3.

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

    Basically, you are outputting NO multiple times per test case. The 2nd for loop shouldn't run if already flag = 1 from 1st loop.

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

[deleted comment]

»
9 часов назад, # |
  Проголосовать: нравится 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

»
9 часов назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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.

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

    Cheater detection phase is after the contest. Just wait a little and be patient.

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

      Ok, thank you to explain.

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

      i've started giving contests quite recently, and i was wondering, how much of an impact do the cheaters actually have on the ratings after the cheating detection phase is over? is it a huge difference? i don't expect more than 5% people to be cheating honestly so i'm not sure

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

    fr man, plus cp is supposed to be a wholesome sport where everyone encourages each other to get better, and cheaters aren't just ruining the sport they are making it toxic too. if i had a +1 rating every time i saw racist comments i'd be tourist lmao

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

hey when will the ratings be out?

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

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

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

    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.

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

I gave yesterday's div 3 contest but now I'm unable to see my submissions.

»
4 часа назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

So happy. I will be blue after this contest

»
4 часа назад, # |
  Проголосовать: нравится 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)

»
4 часа назад, # |
  Проголосовать: нравится -10 Проголосовать: не нравится

I will be rank 1st and beat tourist and jiangly in this contest

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

why Time Limit Exceeded 276190376

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

    Since the testcases cant be seen just yet I would guess that it got TLE because you used unordered_map. It is generally faster than a regular map but worst case is worse. So somebody probably made a hack to exploit this fact. Read https://mirror.codeforces.com/blog/entry/62393 or just use the regular map

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

      thanks,i use unordered_map since i think regular map will sort(log(n)) and i dont need sort.however it TLE.

»
4 часа назад, # |
  Проголосовать: нравится +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.

  • »
    »
    4 часа назад, # ^ |
      Проголосовать: нравится 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.

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

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

    • »
      »
      »
      3 часа назад, # ^ |
        Проголосовать: нравится 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.

      • »
        »
        »
        »
        2 часа назад, # ^ |
          Проголосовать: нравится 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];
        
»
3 часа назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I participated in this contest and solved 1 problem and it was accepted during the contest, but it showing In queue in My submissions

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

    Because system is testing all the submission once again after the completion of hacking period.

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

MY rating is not been updated?

»
118 минут назад, # |
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?

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

When will ratings get published?

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

can someone explain test cases 4 and 7 of G? I am getting 79 and 1 but the actual answers in both cases are 80 and 2 respectively.

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

Would love to know why this greedy approach doesn't work on problem F.

276333164

The idea was to calculate the max cost to obtain the max score on each rectangle, then sort the cost (ascending order) and in case of two rectangles with the same cost, sort by score (descending). Then binary search the score k (obtaining the position i), and check if the sum of scores from of the sorted rectangles from 0 to i is able to obtain k or k+1, then the cost is the cost from the sorted rec 0 to i. If the score from 0 to i result is greater than k+1, then the answer is from 0 to i-1 + intelligent score points in the i-th rectangle.

It's giving WA on test 3, but can't see the case that is failing, if someone has an insight why this won't work or need more info LMK.

(I know it should be solved by DP, but was sure that this greedy approach should work :c)

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

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

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

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

WTF AM I SUPPOSED TO DO NOW

HOW IS THAT MY FAULT