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

Привет, Codeforces!

В 28.02.2023 17:35 (Московское время) состоится Educational Codeforces Round 144 (Rated for Div. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

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

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

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

Good luck everyone!

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

    Generally, I like educational rounds but...

    Worst Contest I Have Ever Seen!..

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

      Worst Contest I Have Ever Seen!..

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

      Worst Contribution Voters I Have Ever Seen!..

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

      turkish.. hmmm... maybe the earthquake is responsible :(

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

        ...Said 10555th of last Div3 xD

        Note that you do not have any right to underestimate or make fun with an event which killed more than 45k people!.. ;( Also, stop racism...

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

Hope problem 'C' of this contest would be easy and not like the previous round.

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

hope this contest will make me expert

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

BTW the cat in vovuh's profile in cute (◠‿◠)

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

I'll try to perform my best in this contest last 3 contests didn't go my way

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

Today is my birthday. I hope that in this round I will get good deltas.

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

Hopefully back to master, been a hardstuck purple for ages now

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

I hope for really good problems and good pastime in this contest!

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

Its better to skip Educational Rounds

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

Why are there so few people take part in this time?

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

hope to get a big delta:)

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

Hope this is my CM promotion contest): (for the third time LOL)

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

Why are so few people participating?

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

всем удачи на контесте! надеюсь задачи будут реально годными и интересными

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

How can problem C be solved? Is it a DP problem? I figured out how to get the length but am stuck on counting the number of them. I also can't imagine that number of sets having maximum size being very large, is my intuition off?

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

    me 2

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

      Hint: In the optimal set, every next element is a multiple of the current one.

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

        I knew that but I don't still know how to solve it.

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

          Well because of that the maximum length is (maximum number of times you can multiply l by 2 while its less than or equal to r) + 1. Also because of this, if you multiply by anything greater than 3, the length will of course be less than maximum. So then you are just multiplying by 2 and 3 the maximum length # of times. Simply fix the number of times you multiply by 2 or 3 and binary search for largest number that we can multiply by that.

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

            There is no need to use binary search to find largest number that we can multipy by that .we can just use r/2/2/2.../2/3 that is the largest number,and the number of above 2 is before we cauculate;

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

    size of maximum subset is log2(r — l) + 1

    to calculate count subset u need to calculate sum (1) (2), where:

    (1) count of i, l <= i, that i * 2^(sz-1) <= r

    (2) count of i, l <= i, that i * 2^(sz-2)*3 <= r, and multiply by (sz-1) (count of take one number from sz — 1 numbers)

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

    It's not a DP problem. For a certain length there can only be some 2 and some 3 as factor, for each number of 3 count the number of valid left boundary for that. Should be fast enough if you pre calculate the combination result.

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

    The set will have this form : $$$[x, 2*x, 4*x, ...]$$$ or $$$[x, 3*x, 6*x, ...]$$$. Note that we can only multiply by 3 at most once, because $$$[x, 3*x, 9*x]$$$ can be replaced by $$$[x, 2*x, 4*x, 8*x]$$$

    Now we will find some $$$x, y$$$ such that for any set that has the lowest number in $$$[l,x]$$$ we can afford to multiple by 3 once, and set having lowest number in $$$[x,y]$$$ can only multiple by 2

    Then the answer is $$$(x-l+1)*maxsize + (y-x)$$$

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

    the maximum length is 1+m, where m is the max value where $$$2^m \cdot l \leq r$$$. Given a set $$$S={ a_0, a_1,\cdots, a_m}$$$, with $$$b_i=a_i/a_{i-1}$$$, one can show that $$$B={b_1,\cdots, b_m}$$$ has only 2s, or exactly one 3( and the remaining values 2). If B has only 2s, one can choose all $$$a_0$$$ in the rank $$$[l, r/2^m]$$$, and if B has exactly one 3, you can chose $$$a_0$$$ in the range $$$[l, r/(2^{m-1}\cdot 3)]$$$, if this range is valid, and the position of 3 in the rank $$$[1,\cdots, k]$$$.

    The answer is: $$$(r/2^m - l + 1) + (2^{m-1}\cdot 3 \leq r/l) * (r/(2^{m-1}\cdot 3) - l + 1) * m$$$

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

    First of all let's calcualate the max length. Notice that it can be achieved in a such way: x 2x 4x 8x and so on. So it can be easily calculated in log(n) time. Now lets find out how all sequences of this length look like, for example for l=4, r=100:

    1. 4 8 16 32 64 -> *2 *2 *2 *2
    2. 4 8 16 32 96 -> *2 *2 *2 *3
    3. 4 8 16 48 96 -> *2 *2 *3 *2
    4. 4 8 24 48 96 -> *2 *3 *2 *2
    5. 4 12 24 48 96 -> *3 *2 *2 *2
    6. 5 10 20 40 80 -> *2 *2 *2 *2
    7. 6 12 24 48 96 -> *2 *2 *2 *2

    So its not optimal to perform any kind of operation except *2 and *3 in this sequence, because if you do *4, you can replace it with *2 *2 and get sequence with higher lenght. Also we dont care about in what order they were performed since multiplication is a communicative operation. Now we can fix number of *3 operations, calculate total number of seq with this count of *3 operation: C(numberof(*3), maxsize) and then find from what numbers they can start.

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

      why do we only consider 2, 3? there's might be multiple of 5:

      like set{5,25} and 7 like {7, 49, ..}, and multiple of prime numbers within the range l, r

      Is it true or i missed understood ?

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

        If we can multiply by 5 it means we can multiply by 2 atleast 2 times as 2*2<5 so multiplying by 5 will never gives the biggest set size.

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

    I got the logic, and my code is working for first 3 examples, but for the case 4 100, shouldnt it be 5 3 instead of 5 7?

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

      you dont count these 4:

      4 8 16 32 96

      4 8 16 48 96

      4 8 24 48 96

      4 12 24 48 96

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

-12 in A... Yay

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

    in Problem A the pattern of BF string repeats so just set the BF string as "FBFFBFFBFBFFBFFBFBFFBFFBFBFFBFFBFBFFBFFBFBFFBFFBFBFFB" and compare every substring of length k to get the answer

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

      It doesn't even need to be that long. The string repeats every 8 characters, and the input string is always at most length 10, so even if the input string begins at the 8th character, it should end on the 17th character at the latest. Therefore, a length-17 string suffices, i.e. FBFBFFBFFBFBFFBFF

      Short Python Submission: 195354083

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

        That might be the case, but overoptimizing can sometimes lead to issues, for example, I overkilled with 200 on A, but for some reason, tried doing away with 2*n memory on D and wasted a good half an hour, which could have otherwise been saved.

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

      should BFB output "YES" or "NO". If we just consider a substring of the larger FB string then the answer is YES. But there a no valid L and R for which the string formed would be exactly BFB. The question is a little contradictory in this edge case.

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

        YES

        $$$\ell = 8, r = 10$$$

        There is no contradiction. Note that $$$\ell$$$ and $$$r$$$ are indices of the FB-string; they don't correspond to any particular values that generated characters.

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

Since the second number can be very large, print it modulo 998244353

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

    First time this is a misleading information in CodeForces for me.

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

    good think that's what happend cause i forget to modulo it :>

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

    In problem C example 4, (input -> 4 100), what are the 7 arrays which satisfy the constraints? I got only 3.

    • »
      »
      »
      15 месяцев назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится
      4,8,16,32,64
      4,8,16,32,96
      4,8,16,48,96
      4,8,24,48,96
      4,12,24,48,96
      5,10,20,40,80
      6,12,24,48,96
      
  • »
    »
    15 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I totally thought that my "perfectly correct solution" is going to get WA

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

Well that C was a bit misleading with that modulo lol

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

Weird contest, managed to solve D easily but failed last minute submission on C xD

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

Can we considering move the contest time to sometimes when Indians couldn't participate? Like almost half (or even more) of the indian accounts ever do is waiting for paid solutions to get out and cheat during contests.

This will also allow the US participants to participate. The start time in the US east coast is 9:30am and 6:30 am in the US west coast. The contests will have a lot more high quality participants rather than just a bunch of Indian cheaters.

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

-7 on A. Sucked all the energy out of me and didn't feel like even trying B or C. Newbie here I come.

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

Were we supposed to do D with an O(nk) DP solution? If so, Python gave me TLE. I really need to learn C++ lol.

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

    I solved it with an O(n) solution, could still fail system test though

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

      Interesting! With the bound of 20 on k I assumed an O(nk) solution was what they had in mind. I'll try this problem more after the contest.

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

        My O(nk^2) solution got accepted. C++ lol

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

        I think they meant $$$O(n)$$$, since $$$k$$$ is so small it can effectively be treated as a constant. The problem gets a lot harder if $$$k$$$ has high constraints.

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

          check my submission 195331445
          it's O(n)
          tell me if it's wrong

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

            It's probably correct, but I still feel like approaches that exploit the small constraints on $$$k$$$ are simpler than approaches whose runtime is independent of $$$k$$$.

            My approach was to first try every possible subarray length of size 1 to k first (everything in the subarray gets boosted). After that, I considered subarrays of length $$$> k$$$ by reducing all values by $$$x$$$, computing the largest subarray sum, and elevating the sum by $$$2xk$$$ to account for $$$k$$$ of the values getting an addition instead of a subtraction.

            This has $$$O(nk)$$$ time complexity, so raising $$$k$$$'s upper bound can cause it to fail, thus making the problem harder.

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

      orz

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

Slept over and woke up right before the contest ended... fortunately I'm unrated.

I've misunderstood statement of D that I must modify k consecutive elements, and I wrote a solution by segment tree. However it's only a dp problem (with annoying corner case for x<0).

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

    for the subarray's length <= n-k , it can be solve by just searching the maximun subarray sum and plus the length*(-x)

    for the length > n-k , just search all possibility from n-k+1 to n .(k<=20)

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

    I don't think $$$x<0$$$ case is annoying. You can observe that when $$$x<0$$$, you should add $$$x$$$ to some prefix(say $$$p$$$) and suffix(say $$$s$$$) such that $$$|p|+|s|=k$$$, and subtract $$$x$$$ from remaining elements.

    Now you can find max subarray in $$$O(n)$$$ using simple $$$dp$$$.

    You have only $$$k$$$ options for $$$|p|$$$. Thus time complexity is $$$O(n \cdot k)$$$.

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

One of the few rounds where B felt far more easier than A. Question A just didn't made any sense and went over my head !!

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

How to solve D

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

    Solution for D:

    This problem can still be solved even under the constraint of $$$0\leq k \leq n$$$.

    If $$$x<0$$$,do:$$$x:=-x,k:=n-k$$$.

    If $$$x \geq 0$$$,we notice it is always optimal to use the "+x" operation for consecutive $$$k$$$ numbers(use proof by contradiction).

    Next, we need to get the max-sub-segment sum of these sequences:

    • $$$a_1+x,a_2+x,...,a_k+x,a_{k+1}-x,...,a_n-x$$$;

    • $$$a_1- x,a_2+x,...,a_k+x,a_{k+1}+x,...,a_n-x$$$;

    • ...

    • $$$a_1- x,a_2 -x,...,a_{n-k}-x,a_{n-k+1}+x,...,a_n+x$$$.

    We can use a segment tree.Maintain a segment tree supporting the following operations:

    • Single point modification

    • Query max-sub-segment sum

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

Worst C ever

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

Worst C ever.

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

perhaps someone solved A in a difficult way.

here is how I solved that. It's really easy and you don't need to debug.

string s; int n;

int main() {
	for (int i = 1; i <= 100; ++i) {
		if (i % 3 == 0) s += 'F';
		if (i % 5 == 0) s += 'B';
	}
	for (int T = read(); T--; ) {
		read(n); string t; cin >> t;
		if (~s.find(t)) puts("YES");
		else puts("NO");
	}
}
»
15 месяцев назад, # |
Rev. 3   Проголосовать: нравится -54 Проголосовать: не нравится

Generally I like educational rounds, but this is the worst contest in the entire fucking century

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

Very nice contest! Congrats to the authors! I really enjoyed A-D, but didn't come up with one solution for D! Can anyone tell his solution?

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

    how to do problem C?

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

      First of all, the maximum size is k + 1, where k is the maximum number such that l * 2 ^ k <= r. Now i want to see what is the maximum number val_left_2 >=l, for which we have val_left * 2 ^ k <= r. This can be done with binary search or math. We have to observe that we can use multiplication by 3 or 2 from the previous number that is in the set, because for numbers greater or equal than 4 you decrease automatically the size of the maximum set, because you use in one operation at least 2 multiplication by 2. We alse have to observe that we can use multiplication by 3 just one time, because if we use 2 times, 3 * 3 = 9, and 2 ^ 3 = 8 < 9, so we also decrease the size of the maximum set. We have to find again using bynary search or math what is the greatest number val_left_3 >= l such that multiplying it just one time by 3 and after that just only by 2, the set has the same size. Suppose the maximum size is k. For numbers that we can multiply by 3 we have k — 1 possible answers, because we can use multiplication with 3 once time in position 2, 3, .. k. Suppose that we have the following example: l = 1, r = 12. We have k = 3(1 * 2 ^ 3 <= 12), so the size is 4. Now we can have the following sets: (1, 3, 6, 12), (1, 2, 6, 12), (1, 2, 4, 12). See that we chose to multiply by 3 at each set the number on the second, third, or fourth position. So the final answer is: (val_left_2 — l + 1) + (k — 1) * (val_left_3 — l + 1). I hope that you understand!

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

Solution for D:

This problem can still be solved even under the constraint of $$$0\leq k \leq n$$$.

If $$$x<0$$$,do:$$$x:=-x,k:=n-k$$$.

If $$$x \geq 0$$$,we notice it is always optimal to use the "+x" operation for consecutive $$$k$$$ numbers(use proof by contradiction).

Next, we need to get the max-sub-segment sum of these sequences:

  • $$$a_1+x,a_2+x,...,a_k+x,a_{k+1}-x,...,a_n-x$$$;

  • $$$a_1- x,a_2+x,...,a_k+x,a_{k+1}+x,...,a_n-x$$$;

  • ...

  • $$$a_1- x,a_2 -x,...,a_{n-k}-x,a_{n-k+1}+x,...,a_n+x$$$.

We can use a segment tree.Maintain a segment tree supporting the following operations:

  • Single point modification

  • Query max-sub-segment sum

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

In E, I solved the problem when the root was fixed. Can anyone tell me how to choose root optimally?

I tried to choose the leaf with a minimum distance to some other leaf, but it didn't work.

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

    You probably can't choose root and need make rerooting (when you calculate dp with fixed root and then recalculate for every root)

    In my solution i fixed k with binsearch and made dp with rerooting

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

Got 5 wrong answer on C and wasted more than an hour over a stupid if statement.

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

Can someone help me figure out why TLE for C, feels like the order is fine.

https://mirror.codeforces.com/contest/1796/submission/195350573

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

    Your time complexity is O(t(r-l)), notice that there could be a lot of test cases

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

      ohh thanks, do you know how many operations per second we can do in codeforces.

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

        Generally, with fast I/O and such, you should be able to handle about $$$10^8$$$ operations per second, but most standard solutions should fall at roughly $$$10^7$$$ operations or less. If you roughly estimate your code as performing $$$10^7$$$ operations, then it should be fine, but if you estimate it at $$$10^8$$$, then it's almost certainly slower than the intended solution and it might end up failing, but it also might actually pass, so it's worth submitting if you can't come up with any improvements.

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

      If i do binary search between l and r then it should be able to pass ig. thanks a lot.

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

Was definitely not an educational contest I liked the questions tho

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

I think that the problems were easy(was able to view only A and B), solved A but messed up in B probably some stupid edge case.

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

When can I able to see the failed test cases?

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

My worst performance ever. I didnt hate the contest but man problem A got me. RIP

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

Why NlogN solutions were not allowed for 'C' ? My solution with TLE :- N*log N DP sol

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

    20000 testcases?...

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

      They should have then given 1sec allowed time limit . I saw top solutions can do in O(1) with some formulae which will be enough to run in 1 sec. I got misleaded with time limit and limit on N. either they should have increased 'r' to 1e9 or decresed time to 1 sec.

      I don't know ,seems like I am frustrated by TLE submissions .Don't mind.

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

        I understand, but the general thing is to check whether statement says something about limit of sum of n (or something like this) or not. Last case means that you have to come up with something like O(log n) for test case (in this particular problem). Nevertheless, sad :(

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

    You need to do it in LogN, because of the number of test cases. I also suspected whether there is a limit on the sum of (R-L+1) over all cases or not, so I asked the judges a question. There wasn't any

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

.

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

Some hints how to solve B?

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

    If the first letters match, we can just form the template with first letter and asterisk.

    If the last letters match, we can just form the template with asterisk and last letter.

    Beyond that, we need to make sure a substring of length at least 2 matches between both strings. If we don't have a matching substring of length 2, the answer is NO (alternating between asterisk and non-asterisk won't work, since there are more asterisks than non-asterisks then). But if we do have a matching substring of length 2, then we can simply construct a template as asterisk, two-length substring, asterisk (equal number of asterisks and non-asterisks so it counts).

    Checking whether the two strings have a matching length-2 substring can be done by simply storing all length-2 substrings of the first string in a set/map (or an array of size 26*26) and then retrieving the length-2 substrings of the second string to check if any of them were found in the first one.

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

What's an example where the answer is 2 for problem E?

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

for Problem C my solution was looping from [l,r] but it was giving TLE on test 3. I supposed my solution should have passed the constraints of 1<=l<=r<=1e6. Can anyone brief on how to predict approximate time complexity based on these constraints.

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

C destroyed me :( How to get total number of possible sets ????? ^_^

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

    Say the smallest number in the set is a. Then all numbers in the largest set are of the form a*(2^x) or a*3*(2^x). Use binary search to find the answer.

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

      Thanks used your idea, actually we can do without binary search Here's my concise code

      void solve(){
          int l, r;
          std::cin >> l >> r;
      
          int n = l, j = 1, cnt = 0;
      
          while(n <= r) {
              j <<= 1;
              n <<= 1;
              cnt += 1;
          }
      
          j >>= 1;
      
          int ans = r / j - l + 1;
      
          j /= 2;
          j *= 3;
      
          if(j > 0) {
              ans += std::max(0LL, (cnt - 1) * (r / j - l + 1));
          }
      
          std::cout << cnt << " " << ans << "\n";
      
      }
      
  • »
    »
    15 месяцев назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    base l, l *2, l * 2 * 2, l * 2 * 2 * 2, .....

    sometimes it is possible to change one of * 2 to 3. But not two of them, because * 3 * 3 > * 2 * 2 2, so if you can do * 3 * 3 and still be <= r you can change them to * 2 * 2 * 2 and increase amount of numbers. Same with * (>= 4)

    first number in base is l, last is l * 2^k. We want to find max l' such that l' * 2^k <= r

    it is r / 2^k, so l, l + 1, ..., r / 2k is good

    same if *2 -> *3, but also * (cnt — 1) because we can chose which *2 to change

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

Not sure why D had k<=20, you could easily solve it in O(N log N).

First, if x<0, then make x=-x and k= n-k. The problem stays the same.

There are 3 cases.

  1. The optimal subarray is nothing (0).

  2. The optimal subarray has length <=k. For this case, we add X to every element and use a sliding window of length K to find the maximum prefix sum with <=k elements. This runs in O(NlogN)

  3. The optimal subarray has length >k. We subtract X from every element and use modified Kadane's to find the largest subarray sum. Then, we add 2*k*x to this value to account for the k elements that we can add X to. This runs in O(N).

Just take the max of these valeus to get the answer

EDIT: I saw another solution solving k<=n, but it used Segment Tree. this solves it with elementary methods.

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

    Could you explain your 2nd case ? If $$$x < 0$$$ then $$$k$$$ can be very big, so the naive $$$O(n*k)$$$ doesn't work. I'm not familiar with the $$$O(nlogn)$$$ technique

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

      If x<0, then do the thing I described in the beginning (set x = -x, k = n-k).

      Then we can use a sliding window to compute the answer, as follows:

      A pseudo code is as follows:

      1. initialize variable to store the best answer for case 2
      2. create prefix sum array, with p[0]=0
      3. make a multiset with just 0 in it
      4. for int i=0 to <n:
      5. if i>=k then delete p[i-k] from multiset
      6. update best answer to max of best and sum of first i elements — smallest element in multiset
      7. add this prefix to the multiset

      if you have any other questions, lmk.

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

Problem D can be solved in $$$O(n\log(n))$$$.

Consider two cases of interval length $$$len$$$ respectively:

  1. $$$len\le k$$$: the answer will be $$$\max(Sum(r)-Sum(l-1)+(r-(l-1))*x)$$$. We can calculate $$$F(r)-min(F(l-1))$$$ for every $$$r$$$ where $$$r-k< l \le r$$$ and $$$F(i)=Sum(i)+i*x$$$. This can be solved in $$$O(n*\log k)$$$ by using multiset.

  2. $$$len>k$$$: the answer will be $$$\max(Sum(r)-Sum(l)+k*x-(r-(l-1)-k)*x)$$$. We can calculate $$$G(r)-min(G(l-1))+2*k*x$$$ for every $$$r$$$ where $$$l \le r-k$$$ and $$$G(i)=Sum(i)-i*x$$$. This is easy to solved.

Here is the code:

/* Generated by powerful Codeforces Tool
 * Author: sleep__
 * Time: 2023-02-28 22:35:03
**/
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
using ll=long long;
const int N=300005,P=998244353;
void solve(){
    int n,k,x;
    cin>>n>>k>>x;
    if(x<0) x=-x,k=n-k;
    vector<int> a(n+1);
    vector<ll> s(n+1),ss(n+1);
    multiset<ll> st;
    st.insert(0);
    st.insert(1e18);
    ll mn=1e18,ans=0;
    if(k==0) mn=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s[i]=s[i-1]+a[i]+x;
        ss[i]=ss[i-1]+a[i]-x;
        if(i>=k) mn=min(mn,ss[i-k]);
        if(i>k) st.erase(st.find(s[i-k-1]));
        ans=max({
            ans,
            s[i]-*st.begin(),
            ss[i]-mn+2ll*k*x
        });
        st.insert(s[i]);
    }
    cout<<ans<<'\n';
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    cin>>t;
    while(t--) solve();
    // while(t--) cout<<solve()<<'\n';
    return 0;
}
»
15 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Can Somebody can say what could be the test case where my solution get failed in Problem A

https://mirror.codeforces.com/contest/1796/submission/195295985

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

    $$$BFFBFFBFBF$$$

    You need to repeat that string more times, as the BF-string is the repeat of $$$FBFFBFFB$$$

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

Problem D can be solved in $$$O(n\log(k))$$$(or $$$O(n)$$$).

Consider two cases of interval length $$$len$$$ respectively:

  1. $$$len\le k$$$: the answer will be $$$\max(Sum(r)-Sum(l-1)+(r-(l-1))*x)$$$. We can calculate $$$F(r)-min(F(l-1))$$$ for every $$$r$$$ where $$$r-k< l \le r$$$ and $$$F(i)=Sum(i)+i*x$$$. This can be solved in $$$O(n*\log k)$$$ by using multiset (or using monotone queue in $$$O(n)$$$).

  2. $$$len>k$$$: the answer will be $$$\max(Sum(r)-Sum(l)+k*x-(r-(l-1)-k)*x)$$$. We can calculate $$$G(r)-min(G(l-1))+2*k*x$$$ for every $$$r$$$ where $$$l \le r-k$$$ and $$$G(i)=Sum(i)-i*x$$$. This is easy to solved.

Here is the code:

/* Generated by powerful Codeforces Tool
 * Author: sleep__
 * Time: 2023-02-28 22:35:03
**/
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
using ll=long long;
const int N=300005,P=998244353;
void solve(){
    int n,k,x;
    cin>>n>>k>>x;
    if(x<0) x=-x,k=n-k;
    vector<int> a(n+1);
    vector<ll> s(n+1),ss(n+1);
    multiset<ll> st;
    st.insert(0);
    st.insert(1e18);
    ll mn=1e18,ans=0;
    if(k==0) mn=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s[i]=s[i-1]+a[i]+x;
        ss[i]=ss[i-1]+a[i]-x;
        if(i>=k) mn=min(mn,ss[i-k]);
        if(i>k) st.erase(st.find(s[i-k-1]));
        ans=max({
            ans,
            s[i]-*st.begin(),
            ss[i]-mn+2ll*k*x
        });
        st.insert(s[i]);
    }
    cout<<ans<<'\n';
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    cin>>t;
    while(t--) solve();
    // while(t--) cout<<solve()<<'\n';
    return 0;
}
»
15 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Since the second number can be very large, print it modulo 998244353....lol

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

Can the answer to question C be greater than a billion?

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

    The answer of 3*2*2*...is less than log(n).

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

      OMG the statement in C confused me a lot.. they said that answer can be very large TT..

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

        is it a kind of mistake although it's one hundred percent on purpose?

        it can't be really large but it says it can be.

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

    Nope. $$$2^{20}$$$ exceeds $$$10^6$$$, so the size won't exceed 20, and you're allowed at most one 3 (three 2s are objectively superior to two 3s, two 2s are objectively superior to any number greater than 3). There are at most $$$10^6/2 = 5(10^5)$$$ possible starting values, so that's already an upper bound of $$$20 \times 5(10^5) = 10^7$$$. This is an incredibly generous upper bound, since having a high number of starting values means the sequences are even shorter, and a good chunk of those starting values won't even be able to accommodate a single 3.

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

any idea why this submission for D gives a TLE? Submission

Help appreciated.

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

In B, I generated all substrings of a and b, stored them in map and checked for the common substring of max length. If its length >=2 then ans will be (string). But this gave TLE. The whole process of map and substring generation won't exceed n^2 where n is length of a which is <=50. Can anyone help me with this? Here's the submission https://mirror.codeforces.com/contest/1796/submission/195333589 I don't get how it is giving TLE, fucked up the entire contest. Newbie here I am

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

    Generating all the substrings actually takes O(N * N * N). Imagine there are N * N substrings in total and each one takes O(N) time to copy.

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

      But inserting in a map takes log(n) time.

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

        It's not true for string type. I didn't read your entire code, but something like set.insert(s) where s is a string makes me concern. When insert() get called, I am pretty sure the parameter string get copied first which takes linear time. Later pushing it down to a ordered structure requires string comparison potentially takes linear time per operation. Overall I believe the time complexity for inserting a string to the set is O(N + N * logN) where N is the length of the string.

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

seeing that amount of hate towards problem C makes me disappointed. so want to remind everyone about this recent discussion about criticism of problems in comments after contest. please read it if you didnt before

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

During contest I thought task C was to count the no. of longest paths in a DAG, got TLE and couldn't think of any other way. Skipping C to solve D would have been a better decision. Also, there is no reason for k to be small, my solution works in O(nlgn). https://mirror.codeforces.com/contest/1796/submission/195367954

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

    As I understand it, $$$k$$$ is kept small to allow for a certain class of solutions to pass as well. Since this is an educational contest, that probably makes sense from the aurbors' perspective.

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

How to solve F?

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

Держите 7 подсказок в виде матрёшки из спойлеров, которые помогут вам решить задачу 1796C - Максимальное множество

подсказка 1

Решение: 195379023

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

Waiting for the editorial.

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

Good luck everyone!

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

195352766 For problem A. Hi can someone help with figure out why my code is giving a wrong answer on test 2. Since it is 144th token in test 2 out of 2046 test cases where the code outputs the wrong answer I am unable to see exactly where I might have a logical error. From all my thinking upto now the error with my code could be the time complexity but since it's not giving me a TLE so that beats me too. Any help would be really great. Thanks.

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

    Counterexample: "BFB", your code output "No" but thats wrong. FB string starts with: "FBFFBFFBFBFFBFFBFBFFBFFB", and fb[7]-fb[9] is "BFB". Problem of your code is that for j%15==0 you add two letter in a row and dont check a substring with only one added letter. I advice to generate fb-string once before solve cycle and just search given substring in fb That will fix this error and also will help with speed.

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

Can someone explain me the dp approach for the Problem D. Thank you in advance..

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

The problems are cool. Love this contest!

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

when will the rating be changed?

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

Joy of Getting AC in last minute >>>>>

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

D is so good that it gave me headache :)
Seriously, I figured out the array needs to be pre processed(minus x), but the prefix complement subtraction is beyond my imagination. Is it something easy to think of or just a common idea? Hopefully not the former one
ps. it sounds way easier as I write it down that way :(

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

    I personally found the idea to be more intuitive when you think of it as querying a ranged data structure. Once it's down to that, it's still probably not very easy. I remember though that I saw a video on youtube, maybe 2022/21, where a Red solved some question that used the idea, basically, each node in the segment tree would need to store 4 values, the sum of all elements under it, the maximum subarray sum, the maximum subarray sum (prefix) and (suffix), using these 4, you can create the required segment tree.

    My submission Here, st_s stores the sum of all child elements, st_m stores the maximum subarray sum, st_lm stores the maximum subarray sum (prefix) and st_rm stores the maximum subarray sum (suffix)

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

Was this unrated?

Why did I not receive any rating for this contest?

Anyone, please tell

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

    Well, I want to know it, too. The System Test is over.

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

    If in any unfortunate scenario, a contest is actually unrated, it gets updated as such on the contest accouncement blog itself. I understand your emotion, I feel the same way, but please be patient, changes can sometimes take longer than expected.

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

When will the tutorial be uploaded ?

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

Problems are so nice just if we removed problem A

Thanks for good BCD !

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

If it had been k <= n in problem D, I would havent got 5 penalties for WA on test 2 (solved the problem in 9 minutes, trying to fix bugs for 30 minutes). Kind of an easy but annoying dp problem imo.

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

why no rating ,it's already 22hours

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

When will this contest be rated?

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

Regex solution for B: 195451488, Perl.

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

https://mirror.codeforces.com/contest/1796/submission/195318855 This code was hacked (TLE) and I missed the first place.

But I just submitted the same code again  https://mirror.codeforces.com/contest/1796/submission/195453193 , then got AC (1606ms) .

It is sad to see this happen due to the blurring of judge speed by time of day :(

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

I participated in this contest and solved one problem but still didn't get any rating changes why? I'm a new to codeforces.

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

    The rating will get updated in some time, for knowing about the expected rating change you could use chrome extension CF predictor

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

    educational round rated slow, this time unusual slow ,but don't worry,just do something else ,you will recieve it later.

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

Excuse me, how could my solution of B get AC on the competition, despite it's wrong and didn't pass the rejudge? Unfortunately, i have no proofs, but yesterday it got accepted, and today it was rejudged and got WA on 1st test.

This solution: 195287792 (it's obviously wrong, but it passed all the tests yesterday)

Upd. the solution above is a little bit messy. Here is the same, but shorter one: 195464083.

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

when are updated ratings coming?

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

Выписал небольшие подсказки под спойлерами, которые помогли мне самостоятельно одолеть задачу 1796D - Максимальный подмассив. Надеюсь, помогут кому-нибудь ещё.

подсказка 1

Мне пришлось писать стресс-тест несмотря на то, что идея оказалась верной. Accepted решение

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

    Выписал небольшие подсказки под спойлерами, которые помогут вам решить задачу 1796D — Максимальный подмассив проще способа, описанного в комментарии выше ;)

    Подсказка 1

    Если кому интересно, ссылка на моё Accepted-решение с описанной идеей и оптимизациями на Python.

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

      Выписал под спойлером решение проще способа, описанного в комментарии выше ;) Настолько, что ему не нужно больше одного спойлера, осторожно!

      Решение

      Если кому интересно, ссылка на моё Accepted-решение с описанной идеей,

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

I finally reached Candidate Master :D

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

Несмотря на жесткий слив и потерю мотивации, я всё равно смог добить ученика в этом соревновании! Спасибо всем, кто поддерживал меня на этом пути!

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

if two people has cheated, both of them were skipped. I think if the rating changing is negative, they shouldn't be skipped.