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

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

Hello Codeforces,

I'm so excited to invite you to participate in Codeforces Round 1111 (Div. 2), which will be held on 18.07.2026 17:35 (Московское время)!

You will be given $$$6$$$ problems to solve, one of which will be divided into subtasks. The problems were authored by me, makrav, and PvPro.

The contest was prepared by two IOI 2026 participants from Russia, so you can be sure that the problems are of the highest possible quality.

I would like to thank these people for making the contest possible:

The score distribution is as follows: $$$500 \ — \ 750 \ — \ 1250 \ — \ (1500 \ + \ 1250) \ — \ 3000 \ — \ 3500$$$

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

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

Our 15th contest

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

last binary contest :|

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

I guess it's speedforces for Problem A,B and C:)

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

Воу, это жи PvPro

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

As a tester, i can't read

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

aaa_Pigeon2 ..., please, don't post .

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

is next contest after this one really 2 weeks later?:( or there will be contests between this contest and the contest that is shown in contest section for 2 weeks later :)

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

The last binary contest for us all :(

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

Our last binary contest for us all :(

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

pls make all questions binary kind (ok maybe not all)

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

оооооо раунд от макрава

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

Last binary contest.

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

way to plaindrome to handle :) 1111

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

Hopefully no more NASA-level constructive algorithm and game theory.

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

Hopefully no more NASA-level constructive algorithm and game theory.

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

as an unlisted tester i secretly tested

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

Thanks for the round , Wishing everyone the best of luck

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

Hope my rating keep 2026 after this contest :)

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

It's so legendary to witness the last binary contest in person.

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

Pov:: Rate -200

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

Amazing number!

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

We got last palindrome contest before GTA 6 :)

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

what if this contest is full of bit manipulation and palindrome based question, just saying.

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

i want to be pupil please make questions easy level

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

I will be live post contest discussion stream here

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

UPD: ok ok... my guess was wrong :(

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

B was good

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

Ideas for $$$D1$$$?

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

    Answer is always a power of two (or zero if the array is already sorted).

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

      $$$2^{mx}$$$ where $$$mx$$$ is the maximum bad index, i.e., we compare $$$a$$$ and a sorted version of it and a bad index is where $$$a_i \ne b_i$$$? This is what I tried, but it's wrong :(

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

        i think we need the maximum different power of $$$2$$$ between an index and the index the value is supposed to be at. so if a number is at index $$$j$$$ and should be at index $$$k \neq j$$$, we look at $$$2^{\lfloor log_2(j \oplus k) \rfloor}$$$ and take the max over all of these and $$$0$$$

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

      That was exactly what I found out but still gott wronng ansss

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

      why??

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

        (Using ^ to mean xor here:) Suppose we want to swap indices i and j. We can express i^j as a sum of powers of 2 corresponding with the 1-bits in the binary representation of i^j, then perform a sequence of swaps at distances that are powers of 2.

        That means if the highest one-bit in i^j is pow(2,m), we can swap i and j if and only if k ≥ pow(2, m). Values of k in between powers of 2 don't change the pairs of indices that can be swapped (indirectly): only values of k that are powers of 2 unlock new swaps.

        Concrete example: to swap 11 (0b1011) and 17 (0b10001); we can calculate 11 ^ 17 = 26, so when k ≥ 26 we can swap them directly. But we can decompose 26 = 0b11010 = 0b10000 + 0b01000 + 0b00010 = 16 + 8 + 2.

        This means that already when k ≥ 16 we can swap: 11 with 11^16 = 27, 27 with 27^8 = 19, 19 with 19^2 = 17. Now the element at index 11 is at index 17. (The element that was at 17 is now at 19; we can do the swaps in reverse to move it to element 11, and then the effect is that 11 and 17 are swapped while no other elements have moved.)

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

    I can tell it we had to go by powers of 2 I suppose, however I couldn't figure out, but point of interest was near the powers of 2. Waiting for editorial

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

      I thought the the value of k would at most be highest bit of the largest index not in its correct sorted position. I tried but it didn't work. I suppose you can reduce the value of k further if there were other guys with the same highest set bit so they cancel out..can anybody tell me was this the solution...

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

    Binary search

    When checking for k, you can notice that each block of size x (smallest power of 2 greater than k) can be swapped arbitrarily, so the smallest x numbers need to be in the first x, next x numbers in the next x positions, ect

    idk for D2 tho, someone pls help, is it segment trees?

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

    The thing is that we group elements by groups of 2^m from left to right. For example: A = 2, 1, 5, 2 -> [2]. [1]. [5]. [2] -> [2, 1], [5, 2] -> [2, 1, 5, 2] And we check whether sorting every group independently sorts the whole sequence: A = [2], [1], [5], [2] Not sorted A = [1, 2], [2, 5] Sorted so we print the size of the group.

    This solution works for every array A except for when A is already sorted, in which case we print '0'.

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

    k = max(k, MSB(current index after sorting ^ index before sorting))

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

I need stronger examples in C and D

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

How D2 awa

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

    First solve D1 with merge sort.

    Then, the initution of that using some data structure comes out.

    Well, let's try segment tree first(for convience, push $$$10^9$$$ to the back of $$$a$$$ until length of $$$a$$$ is a power of 2). So, our segment tree must maintain the answer itself.

    Let's say a chunk is an interval starting at $$$x \times 2^y$$$ with length of $$$2^y$$$. $$$y$$$ can be 0.

    By looking at the procedure of D1, we'll see that for a chunk, if the maximum of the left half is strictly greater than the minimum of the right half, then $$$k$$$ must be at least the length of the chunk divided by 2.

    So we just maintain range minimum, range maximum, and answer(note that we made the length of $$$a$$$ a power of 2, so a node on the segment tree just maintains a chunk).

    TC: $$$O(n + q \log n)$$$

    Implmentation

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

D1 GOOD problem.

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

I could NOT submit my solution to D2 due to cloudflare. How to solve this problem.

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

I forgot that merge sort tree works in O(log^2) and tried to use it in D2. Does anyone have ideas on D2?

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

    I thought log(n)^2 = log(n^2) = 2log(n) lmao :(

    I got a O(q*log(n)^2) solution using binary search and segment trees, but it TLEs :(

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

    Having blocks-split array, and knowing max and min in each block, array can be sorted if $$$max_i \leq min_{i+1}$$$. You can keep such "broken" pairs of blocks for each log-level if you do segment tree updates, and verify the vertex against it's left and right neighbors

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

D is a really awesome problem. I am not sure why $$$10^6$$$ is needed as constraint considering solution seems to be $$$n log n$$$, but anyway really cool one. And the update part adds some cool complexity.

It was really unexpected for me to have a need for formula of left/right neighbor in a segment tree (and generally, analyzing it's layers seems super cool!).

For E it was not obvious that (n, 1) path is also needed. The problem without closing the loop seems maybe even more interesting, so I spent quite some time on it and seems to be a bit late to solve:(.

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

    I think the $$$10^6$$$ is meant to prevent some $$$O(n log^2n)$$$ ideas for D2 like maintaining a set for each $$$2^k$$$-sized interval.However they didn't make it tight enough to prevent some $$$O(n log^2n)$$$'s from passing on D1 (like sorting on each $$$2^k$$$ interval)

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

A,B,C were fire :D

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

https://codeforces.me/blog/entry/133949

Was there really a necessary reason for D2 to have n,q <= 1000000 rather than 200000 or even 500000 on a 2 second time limit? All this really did was pretty much screw over anyone using Python. (https://codeforces.me/contest/2247/status)

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

Did anyone have a segment tree implementation for D2?

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

Problem C with subarray instead of subsequence could be interesting. Wondering if there is an efficient solution. Wasted most time trying to solve that.

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

    In problem c the only observation was you have to see how many 1's you have to invert as you can invert any number of zeros with a 1. So if number of 1s to invert are even than answer is 2 otherwise answer is 1. However you have to also check one case where number of 1s to invert are zero but there are zeros you have to invert to 1. so in this case the answer depends on whether ther is a 0 that doesn't need to be inverted in which case answer is 2 otherwise answer is -1.

    edit: yeah there is one more annoying case when there are no 1s than the answer is -1. I was dumb enough to get wa on this case and got stuck in it for nearly an hour :(

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

Finished this game and I had to say there are so many construction games in this contest

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

what was the idea behind c? what i did: if a = b: ans = 0 if not sum(ai != bi): ans = -1 (subsequence of need to be inverted elements consist of only 0s) ans = 1 if s%2 else 2 i failed with this approach and im clueless what did i do wrong so please hint me

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

Was an honor lost rating to the last binary contest

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

ну, немного какая то шляпа была, F показалось легче D2, а так контест крут и уважение авторам

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

Really awesome contest!!!

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

I'm so unlucky... I did not have time to participate... nooo... BTW good problems. I could be MASTER XD

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

I think i got lucky because i coded D1 like almost brute-forcably only adding pragmas it is like 60% brute

(if there is a hacking phase i wouldnt think ill be safe from TLEs)

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

D is a great problem, I got D1 but unfortunately, I couldn't solve D2 in time.

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

E < C. The first guess works. 3000 points for what, yikes.

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

I had made 3 submissions for the problem D1. Initially 3 of them were accepted. But, after the contest ended, 2 submissions were marked with the verdict "Skipped" and only the last Accepted submission of D1 has the verdict "Accepted". Due to this, my score for D1 got reduced. Any idea why this happens?

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

i thought 1111 would be the lucky number so this round also be a lucky one......alas!!:)

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

Hello, could you please explain why my account was blocked during this contest?

Account:

https://codeforces.me/profile/troyanorte

https://codeforces.me/submissions/troyanorte

How can I submit an appeal and get my account unblocked? I solved all the problems during the contest, but my account was blocked afterward. I would appreciate it if you could review my case and explain the reason for the ban. Thank you.

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

finaly i hav rating hehehehehehehehehhehehehe

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

what was question D man it was genuinely tough atleast try to sympathise us and give a little easy

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

Good Round, take me to Specialist again!

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

Oh no, I didn't realize that resubmission doesn't count toward the first solve. Missing the first solve of F because of this :(

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

Dear codeforces

I want to sincerely apologize for my actions in this contest. I didn't think my cheating would have consequences like this.

I have learned my lesson from this time. I feel I deserve to be punished for this, but in my account i have a lot of course about coding, so i hope i will be forgiven for my actions to continue practice (and skipped all my submission in this contest to roll back my rating).

I promise I won't join any contests after and will only use my account to practice

Against, I apologize for my actions last week, and I knew rating isn't important, it's just a number

Thank you for your understanding, and I look forward to practicing more on Codeforces

Thanks a lot, have a good day!

(Sorry for my bad English)

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

Well, this afternoon I recieved a message from the system that tell me my submission for D2 was similar to many others submissions, and all of my submissions got skipped. So I was about to write a message to the Codeforces team since I have concrete evidence that can prove I wrote my code (with logs and the idea for the problem was kinds of classic and identical) and the reason my code seems similar to many others is because I used the segment tree template from VNOI Wiki, a published educational community of competitive programming(see this: https://wiki.vnoi.info/algo/data-structures/segment-tree-basic.md). But after a while I realized my submission verdicts changed from skipped to Accepted again, while some of the other's in that message still got skipped. Of course I don't have any problems with this=)))), just being curious what exactly happened? Did they kind of doubled-check or something like that? And do I need to do anything else to prove to the Codeforces team that I wrote the solutions myself?

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

Hi, my submissions are marked as skipped and my participation shows Out of Contest. I received a similarity warning but i wrote my solutions independently in vscode(i can provide timestamps) and did not share or use anyone else code.

Also, the warning seems to reference my own submission ID as a match, which looks unusual. could you please clarify the reason or this and review the case?

Thank You.

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

Subject: Appeal for Plagiarism Warning — Problem 2247D1 (Template Coincidence)

Hello contest admins,

I am writing to politely request a manual review of a plagiarism warning I received for problem 2247D1. My submission (383347453) was flagged as significantly coinciding with submission 383369119 by user 12345678raaz.

This similarity is entirely coincidental and might be due to the use of a template. I usually keep a template of the type of pattern questions. I don't know how it coincided with the other person because I don't even know that guy. Also I don't even know if he is from the same country or not.

Could you please manually review the submissions? I am confident you will see that the overlapping sections are strictly boilerplate code.

Thank you for your time, hard work on the platform, and understanding.

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

Looking forward towards it

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

How to solve A any idea?

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

Thanks everyone for participating in Codeforces Round 1111(Div. 2). Although it was initially difficult to understand from the editorial when I first participating in Codeforces contests. However I found that once I got used to it, the explanations felt very easy to understand, accurate, and highly academic.

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

Hiii everyone i am looking for friends that will put me through and you know just chill. I really want to get better so if you feel you could help me with that i'd appreciate it

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

upvoteme

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

Upvote me

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

During the recent Codeforces Round 1111 (Div. 2), I noticed that the code of user DancingInTheLight shows signs of being written by two different people or of using an LLM. Specifically, in problems D1, D2 (383370496, 383373125), he changed the entire algorithm within just 6 minutes, and the subsequent code uses long, uppercase variable names, so I strongly suspect it's AI code. I sincerely hope that the administrators MikeMirzayanov, awoo, KAN, and the contest organizing team makrav will permanently ban this user.