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

Автор TheScrasse, 11 месяцев назад, По-английски

Ciao, Codeforces! We're glad to invite you to take part in Codeforces Round 1053 (Div. 1) and Codeforces Round 1053 (Div. 2), which will start on Sep/24/2025 14:35 (Moscow time). You will be given 7 problems and 3 hours to solve them in both divisions.

Note the unusual starting time.

  • One of the problems will be divided into two subtasks.
  • One of the problems will be interactive, so please read the guide for interactive problems if you are not familiar with it.

The problems were authored and prepared by Dominater069, satyam343 and me.

We would like to thank

Score distribution:

  • Div. 1: $$$500 + 1000 + 1750 + 2500 + (2000 + 1750) + 3250 + 4250$$$
  • Div. 2: $$$500 + 1250 + 1250 + 1750 + 2500 + 3250 + (2750 + 2500)$$$

We hope you'll like the problemset!

UPD: Congratulations to top $$$5$$$ in Div. 1 and Div. 2.

Winners

UPD 2: the editorial is out.

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

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

almost all the authors & testers are RED

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

As a tester, I highly recommend the interesting problems in the round!

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

Will be fun fs

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

testers OR!Z

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

Cant wait for another satyam round orz

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

Contest of my favourite coders!

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

Where is __baozii__? Does he want to reach IGM?

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

Satyam343 round omg

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

Satisfactory contest time for Chinese participants huge W

As a participant, hope the contest has great problems and may it be cheater free!

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

Satyam343's round omg!! Already scared.

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

If your rating_range<=1600 then the 3 hour contests is not for you , it's for those cheaters.

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

Please note the unusual start time

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

As not a tester, I highly recommend the interesting problems in the round!

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

So what is a ":smiling_face_with_sunglasses: :skull: :grinning_face_with_sweat: :upsidedown_face: coordination"?

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

Where __baozii__ went?

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

my first div1

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

Math contest is about to happen

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

500 to 1250.... damn. and C is also 1250

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

Why the unusual timing on a weekday?

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

That's a hell of a coordination.

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

Here , Everyone is my favourite coder, especially Dominater069.

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

Looking Forward to it!

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

Hope to reach CM :)

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

Participating in this contest. My target for this contest to solve three problems. Best of luck to all participants.

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

Hope I can get a good grade

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

How high the average rating of testers are...

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

excited

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

Quite sad because I’ll probably miss this contest since it’s happening earlier than usual.

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

The time is really really wonderful!Finally no more staying up late!I would also like to thank the experts who set the questions and conducted the tests; your hard work is appreciated.

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

As not a participant, I will not participate

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

I love java! console.log("hello world");

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

Codechef admin coordinated a round on Wed. and clash with the Codechef round by 5 minutes :(

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

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

As a tester of the round based on OII 2025, I must show you this meme.

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

Sad that I got classes on that time but best of luck to all other participants

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

Highly praise the friendly starting time!

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

The time is very kinds for Chinese OIer.I can play the contest but don't have to Staying up late.

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

Is Div1 rated for everyone or just above master

Like can I register to Div1 today and be rated?

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

Add time

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

zur

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

Div.2 => Div.(1.5)Forces

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

why my friend's account creative2024 be banned during the contest. He wonders how can he appeal under this situation.

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

Jaw dropping Contest!!!

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

The queue is now over 10 minutes long, what happened?

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

Why in queue?

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

It’s been a long time since a Div. 2 B problem made me think this much.O⁠_⁠o

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

I hope everyone is enjoying.

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

Any intuition to Div2E?

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

Was D that easy? How so many people solved it? How to solve it?

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

    example image helped a lot in guiding my thoughts in correct direction.

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

    i think i got the pattern but wasnt able to implement it properly ... although i need to prove that that pattern is universal and then implement :((

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

    You can prove (by induction on the rows) that the black squares aren't under the left and right diagonals. After that, iterate from the center of the square row $$$i$$$ by row $$$i$$$ and pick which $$$a_i$$$ black squares you want to keep in row $$$i$$$ out of the $$$n - \sum_{j \gt i} a_j$$$ you have remaining.

    You also need to check that $$$a_i$$$ add up to $$$n$$$ and that none of the ones after the middle are nonzero. All of this is relatively straightforward to prove.

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

disaster! can someone please give hints for Div 2 B (the contest is over)?

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

    you can do greedy solution.. the main thing that you have to observe is that looking for next white cells by brute force does not actually give TLE.. cause at some point next cell will be out of range of the existing set. at least i passed the pretest with it.. don't know what will happen in system testing

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

    It can be done greedily in one pass. The only time a next person is gonna be at different cell than where current person ended while following command 'B'. Since ending at command 'B' makes the cell black, and for the next person, he must be at next white cell when following the B command

    for (int j = 0; j < n; ++j) {
        if (c[j] == 'A') {
          p++;
        } else {
          p = findNextWhite(p + 1, black, nextWhiteMap);
        }
        black.insert(p);
    
        if (c[j] == 'B') p =findNextWhite(p+1, black, nextWhiteMap);
      }
    
»
11 месяцев назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Sooooooo Hard B and C TAT. I'm not good at them,but I learned a lot.Thanks for the contest

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

The problems were exciting. Nearly solved 3 this time, couldn't figure out how to optimze O(n²) to O(n)

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

problems B and C are consisted of pretty simple ideas, but finding out it took to many time for me...

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

Why were the hacks disabled for Div2B $$$?$$$

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

Spent a lot of time thinking on E, but couldn't formulate anything. Can someone explain?

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

Honestly I have no idea how my E12 passes, how to calculate random shuffles fail probability?

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

    How shuffling work? So if a problem is hack-free then likely it is probability-based? Only saw one other problem like this before. And isn’t the proper way of solving recursively dividing the array into 2 and ask to see the single value appear in which part? Although that gives the wrong guess for version 2.

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

      Usually when the problem has fixed number of tests, you might consider writing some randomized algorithm. Probably there are another cases where problem needs fixed number of tests while not using randomized algorithms, I don't know them tho.

      You can use shuffled indexes for queries while dividing the array into 2. This should reduce number of queries, but i am not sure how much it reduces.

      Also your code finds correct guess for version 2, but just uses too many queries i guess

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

Div1 E1 is kind of problem that makes people submit the worst ideas they've got. My local stress started passing on 3:14 and it was not enough to fix minor stuff and submit :cry:. Not sure what was the purpose and intended approach of the problem, need editorial.

Div1 BC are sweet, F is interesting (like I dont even understand how one can solve bamboo in 2 rounds). I definitely had some troubles with the way some problems were formulated — maybe this is even good against LLM's understanding problems but unfortunately it's also against me understanding problems.

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

hints for C? didnt have to time to find C since spent so much time for B

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

    You want to delay people from leaving for as long as you can; how can you do this?

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

      I got the observation in first go but somehow couldn't code it. Can u give me some hints on how to go about implementing it?

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

        You need to be able to:

        1. sum up a prefix in $$$a$$$
        2. sum up a suffix in $$$a$$$
        3. sum up some subarray of alternating positive and negative elements of $$$a$$$

        You can easily do 1 and 2 with a regular prefix sum. For 3, you'll need to calculate two prefix sums (or notice that $$$\text{psum}_1 = -\text{psum}_2$$$ and just negate), one for $$$[a[0], -a[1], a[2], -a[3], ...]$$$ and one for $$$[-a[0], a[1], -a[2], a[3], ...]$$$. Once you have these, you can just use them to calculate the middle part.

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

        Compute an array of segments seg[i] = a[i+1] — a[i], then build two prefix sum arrays: pre_odd for odd-indexed segments and pre_even for even-indexed segments. For k=1, take the sum of all odd segments. For k>1, exclude the first and last k-1 segments of the relevant parity (odd if k is odd, even if k is even) and use the prefix sums to quickly calculate the sum of the middle segments. Keep counters of how many odd/even contributions have been used so far, and iterate this process for all k.

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

        for n=6, the signs will go like this. find a way to add this pattern

        k=1 [ -ve +ve -ve +ve -ve +ve ]

        k=2 [ -ve -ve +ve -ve +ve +ve ]

        k=3 [ -ve -ve -ve +ve +ve +ve ]

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

        Thank you everyone (◕‿◕✿)

        UPD: I finally got AC. My submission

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

      my proof for c: any two consecutive segments would differ by 1 in contribution, as the point between them would be used as entrance or exit to already entered visitor. to prove why the said construction works, we can see that parity of contribution of an segment remains same so 4 contribution segment couldn't do 5 contribution(). now we greedily chose maintaining contribution<=k.

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

today, maybe I'm spcialist

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

div2 a is fun, but what's the meaning of div2 b and c, and c is so typical!

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

I have a max flow solution for Div2E is it supposed to pass

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

It was intresting lol

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

I worked out CTS2024D1T3 so I know the solution of 1F but I forgot there is T in 1E so I have no time to finish 1F

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

This was my hardest contest so far, maybe I’m too used to quick A/B solves :)

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

Why Foredawn is not banned even he is unrated and solved 7 problems

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

Hey is it rated

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

Anyone give me some hint how to approach the problem B div2 i was unable to do that...

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

Any editorial for E div2?

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

    Define $$$p_a(i)$$$ and $$$p_b(i)$$$ to be the positions of element $$$i$$$ in the preference arrays of Alice and Bob respectively.

    Let's say that the set of elements Alice takes is $$$i_1, i_2, \dots i_m$$$ where $$$p_a(i_j) \lt p_a(i_{j +1})$$$ ($$$j \lt m$$$).

    How exactly can we get Alice to take exactly this set of elements?

    • Bob takes elements until all elements in the subarray $$$a[1, p_a(i_1))$$$ have been taken.
    • Alice then takes $$$a[p_a(i_1)]$$$
    • Bob takes elements until all elements in the subarray $$$a[p_a(i_1) + 1, p_a(i_2))$$$ have been taken.
    • Alice takes $$$a[p_a(i_2)]$$$. .
      .
      .
    • Alice takes $$$a[p_a(i_m)]$$$.

    Notice that when taking $$$a[p_a(i_j)]$$$, it must obviously not already have been taken by Bob.

    We therefore derive a necessary and sufficient condition for a subset of elements $$$S =[i_1, i_2, \dots i_m]$$$ to be attainable by Alice:

    $$$\max_{k \leq p_a(i_j), k \notin S}(p_b(a[k])) \leq p_b(i_j) \forall (i_j \in S)$$$

    This motivates the following naive dp formulation:

    Define $$$\text{dp}(i, x)$$$ to be the maximum score of some Alice-attainable set $$$S$$$ from the prefix $$$a[1, i]$$$ wherein $$$\max_{k \leq i, k \notin S}(p_b(a[k])) = x$$$. The transitions take the following outline:

    dp[0][0] = 0
    for i from 1 to n:
        #we take the current element
        for x from 0 to p_b(a[i]) - 1:
            dp[i][x] = dp[i - 1][x] + v[a[i]]
        #we dont take the current element
        for x from 0 to p_b(a[i]) - 1:
            dp[i][p_b(a[i])] = max(dp[i][p_b(a[i])], dp[i - 1][x])
    

    This runs in $$$O(n^2$$$) and it's trivial to optimize the transitions to $$$O(n \log(n))$$$ using segment trees.

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

    There is a n^2 dp solution where dp[i][j] — maximum value of first i items Alice has taken when Bob has taken j of his first items.

    Let p[i] — position of element i in Bobs list

    The transitions from i to i+1 when someone takes item a[i].

    For each j:

    • if Bob has already taken this item dp[i+1][j] = dp[i][j]

    • if Bob hasn't taken this item dp[i+1][j] = dp[i][j] + v[a[i]] (Alice takes the item)

    • Bob can take the item if not taken yet dp[i+1][p[a]] = $$$\max_{0 \leq k \leq p[a[i]]}$$$ dp[i][k]

    This solution is n^2 but it can be optimized by saving this dp in a lazy segment tree.

    This is my solution, don't know if intended

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

It was a horror show...!

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

Amazing problems , enjoyed Div 2 B...

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

I got a solution of D1E with expected $$$3.5n+2\log_2 n$$$ on average, and failed both E1 and E2.

Then I improved the solution to $$$2.75n+2\log_2 n$$$, passing E1 and E2 at the same time, despite that $$$35$$$ of $$$10^6$$$ local tests failed. (which seems to be too bad, as E1 has around $$$3.2\times10^5$$$ testcases.)

No idea of why did it get accepted, and why are the boundaries $$$4n+2\lceil \log n \rceil$$$ and $$$925$$$.

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

The round I reach GM.

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

Lost the opportunity to jump over IM in somewhat amusing way...

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

What do you guys think of problem B and C's rating?

I learnt that I need to practice more greedy/implementation/construction problems in a similar range :(

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

it was hard for me because i'm newbie

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

Appeal for Flag on My Submission 340186188 for Problem 2151E

Hello Codeforces team, I would like to appeal the flag on my submission 340186188 for problem 2151E in this contest.

I would like to assure you that I wrote my code independently and did not share it with anyone or view anyone else's solution during the contest. The similarity in the solutions is only coincidence due to the nature of the problem itself.

My Logic for Problem E I solved using a dynamic programming approach, but to make it more efficient I also optimised my data structure. As you may know, this is a standard technique in competition programming. The logical steps to think of this solution are quite constrained, which could lead to similar code from my peers. Here are my steps: 1. My primary thought is to process Alice's preferred items one by one. It is natural to maintain dp[j] to represent the maximum value of Alice's items after Bob has picked his j most preferred items.

  1. A naive O(n^2) dp solution would be too slow. As I notice that we must update range and point between states, I decide that a Segment Tree is the fastest data structure to optimise the program to O(nlogn). My code uses a segment tree and lazy propegation to handle the range additions faster.

  2. When I am processing Alice's i-th preference A[i], I let its position in Bob's list be p. The logic inside the loop is divided into cases:

    • Case 1: Alice takes A[i]. This is possible if Bob did not take it yet. In this case, Alice's value increases by v[A[i]]. This is implemented as a range add operation st.add(1, p, v[A[i]]).
    • Case 2: Alice does not take A[i]. This means Bob will eventually take it instead, which is B[p]. To handle this transition, I need to find the best possible score Alice could have gotten before this turn by using st.queryMax(1, p). This value is used to update the state when Bob takes p items, which is what st.chmaxPoint(p+1, bestPref) line does in my program.
  3. My segment tree code is a standard template I used for many problems. Data structures have common structure, using function names like build, push, add, and query. Variables like mx for maximum and lz for lazy are also common. Maybe this is one more reason why my solution looks similar to my peers.

In conclusion, as this specific dynamic programming method is the most efficient way I could think to solve the problem, it is maybe also that other contestants who are familiar with these methods would think of the same logic and similar implementation.

Proof of Innocence

I wrote my code within my local Visual Studio Code environment and did not use any public IDEs like ideone.com. I am not sure how to find the cache/logs or file histories, but if you would inform me on what details you would like to verify, I can try providing. To avoid this in the future, I will use a local Git repository.

Thank you for your time. I am just a mathematics and computer science university student trying out the Codeforces platform. I have read the rules and understand them very seriously. I hope this explanation clarifies my solution and shows that it is my own independent work.

Sincerely, ComplexBulb

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

Appeal for Plagiarism Flag on My Submission 340173657 for Problem 2151D

Hello codeforces team, I am writing again to appeal second flag I received from same contest. This appeal is for my submission 340173657 for problem 2151D. Once again, I want to say that my submission is my own work. I did not teamwork with anyone, nor did I find external solutions during the contest. The similarity I guess comes from the mathematical and algorithmic type of the problem.

Explanation of My Logic

This problem is a combinatorics and counting problem.

  1. The problem's constraints on black cells can be reduced to a known problem of counting permutations with restricted positions (such as placing n rooks on an nxn board without attacking each other). My solution uses a formula derived from this.

  2. The number of valid grids can be calculated with the following steps, which my code implements directly:

    • A necessary condition for this problem is that the total number of black cells must be exactly n. If not, the answer is 0. My code first checks this.
    • then, the idea of my solution is using that the problem constraints can be modeled by a sequence m, such that m_k = min(k, n + 1 — k). This sequence will give me the available choices at each step.
    • The number of ways to place n cells according to the rules is given by Π (m'_i — (i-1)) for 1 ≤ i ≤ n, and m' is sorted(m). My code calculates this product. The line pref[mi] — (i — 1) in my loop does this calculation, using prefix sums of a to find the available choices in the rows.
    • Last step is, since the a_r cells inside a given row r are indistinguishable, we must divide by a_r! for each row. I wrote my code by multiplying by the (precomputed) modular inverse of each factorial.
    • The functions for modpow and the precomputation of factorial and modular inverse factorials are fundamental tools for any combinatorics problem on the Codeforces competitions. This code is very common and similar across all programmers templates.
    • The rest of my main function is a direct implementation of my mathematical formula. I simply calculate m, sort m, calculate prefix sum, apply the product formula. This is the most simple and logical way to implement the solution. There is very less creative difference in this type of solution.

As the solution is a direct implementation of a mathematical formula, most people who correctly solves the problem will produce code that is similar with me in logic.

Same as my previous appeal, I wrote this code in my Visual Studio Code local development environment. I am fully prepared to explain my thought process and the derivation of the formula in more detail to prove that my understanding is my own.

Sincerely, ComplexBulb