FelixArg's blog

By FelixArg, 2 months ago, translation, In English

Hello, Codeforces!

sevlll777 and I are glad to invite you to participate in Codeforces Round 1079 (Div. 1) and Codeforces Round 1079 (Div. 2). Both rounds will take place at Feb/11/2026 17:35 (Moscow time). There will be 6 problems in each round, some of them can be divided into several subtasks. You will have 3 hours to solve all the problems. The round will be held according to the Codeforces rules and will be rated for both divisions.

At least one problem will be interactive, so we highly recommend to read guide for interactive problems before the contest.

We would like to thank:

UPD 1: The score distribution is as follows:

  • Div. 1: $$$500 - 750 - (750 + 750) - 2250 - (2000 + 1000) - 3500$$$
  • Div. 2: $$$500 - 1000 - 1250 - 1500 - (1500 + 1500) - 4000$$$

UPD 2: Editorial

Wishing everyone good luck and high ratings!

  • Vote: I like it
  • +416
  • Vote: I do not like it

»
2 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

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

»
2 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

Hope to be specialist.

»
2 months ago, hide # |
 
Vote: I like it +126 Vote: I do not like it

Friends, I found out why testers often write the first comments under an announcement, they are tagged and see the post as soon as it is published, even before it gets pinned on codeforces main page.

»
2 months ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

CONTEST LEAK: This contest may require a computer that is turned on to participate in.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope to be able to do that interactive problem for once.

»
2 months ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

IMG 20260106 223718 702

»
2 months ago, hide # |
 
Vote: I like it +36 Vote: I do not like it

As a tester I wish you good luck

»
2 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

Hope to become expert again:)

»
2 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

3 hours. 6 problems. One newbie.

Plan: solve A calmly, fight B honestly, and respect C from a safe distance.

See you on the standings.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

time to get goomba stomped

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Not that important but it will be my 100th contest.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope to become pupil again:)

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how to become a green tester

»
2 months ago, hide # |
Rev. 2  
Vote: I like it +1 Vote: I do not like it

users with innate techniques vs users with mahoraga ( llm's)

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Because of downvoters,I edited what I wrote here.

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

wishing to hit a jackpot like hakari in this contest

»
2 months ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

»
2 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Hope interactive problem is not a query on a tree.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Good luck to everyone guys!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

GLHF!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

JJK???

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hey! I wanna how to be testers

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

again a contest clashing with codechef starters ...

»
2 months ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

CF have been arranging contests on Wednesday lately. I'm assuming that's just a coincidence.

»
2 months ago, hide # |
 
Vote: I like it +34 Vote: I do not like it

Kirara! :o

»
2 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

Acrux ⭐

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope to become expert again

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Do moltbot ai's participate too?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Are you Dresist because you are expert or you are expert because you are Dresist.

»
2 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

Olá Christopher Ciafrino, bem vindo aos comentários.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope that I can solve A and B, or even C! Anyway, GLHF

»
2 months ago, hide # |
 
Vote: I like it -18 Vote: I do not like it

I think this contest will be easy.

»
2 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

This contest must satisfy:

🇧 $$$\ngtr$$$ 🇨

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I like problem C. I need more problems like C in my life.

»
2 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Didn’t think A would be that hard

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

I suck so bad. Slow solve on A, B, C. Couldn't solve D. Bad performance after another.

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

I seriously don't know if C is real or troll and why difficulty(C) > D also why is "ALICE" not accepted but "ALice" is accepted in C got a penalty for this! But enjoyed the contest!!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Crazy that the one dimensional intuition for Div1 D can be extended to two dimensions (I think, I couldn't prove it)

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I wonder if we have half the number of solved if A is swapped with D.

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

This was a complete disaster for me. The problems seemed hard largely because this is the first time I faced such problems (C and D) and I was already feeling ill and also started late because I wasn't present when contest started...

»
2 months ago, hide # |
Rev. 2  
Vote: I like it +5 Vote: I do not like it

In my opinion, 2C is way easier than 2B. On the other hand, 2A is quite hard (which took me a while). By the way, can someone tell me how to do 2D please? Great contest anyway!

  • »
    »
    2 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it +8 Vote: I do not like it

    I solved it with sqrt decomposition.

    Say you fixed i. Now, you wanna count how many j (i<j) there are such that a[i]*a[j] = j-i. We can iterate over the values the product a[i]*a[j] could have (that is, over all multiples 'm' of a[i]) and checking whether a[i+m] = m/a[i]. Notice we can stop once we reach m >= n, because j-i is at most n. This gives a complexity of O(n/a[i]) for each a[i], and it is doable if a[i] >= sqrt(n).

    Now, we need to find a way to solve for a[i] < sqrt(n). My idea was to precompute the answer for all a[i] = k for some fixed k in O(n).

    I will iterate over the whole vector. Say I am at the jth element. I wanna check whether this guy matches an index i (i<j) such that a[i] = k and a[i]*a[j] = j-i. Since a[i] is fixed, I simply compute their distance d = k*a[j] and I check whether a[j-d] = k. If it is, I found a pair and I increment the answer.

    The total time complexity is O(n*sqrt(n)), because we precompute the answer for a[i] = k < sqrt(n) in O(n) (there are sqrt(n) many values for k) and we compute the answer by "bruteforce" in O(sqrt(n)) for the remaining elements (and there are at most n of those).

    Edit: submission

    • »
      »
      »
      2 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      You could have done when iterating for the smaller one you could have subtracted to cover the case for a[i] > a[j] basically the question wants to find i,j such that

      j-i=ai*aj so i<j we can have i getting the bigger value in that case j would be smaller and you subtract and we can have i gettig the smaller value and in that case j would be bigger so u add

    • »
      »
      »
      2 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it 0 Vote: I do not like it

      I solved it with a Sparse Table using a similar pruning logic!

      Instead of splitting cases based on $$$\sqrt{n}$$$, I used the Harmonic Series observation for all $$$i$$$ (since all candidate $$$j$$$ must be $$$k \cdot a[i]$$$ steps away from $$$i$$$ for some integer $$$k$$$).

      To handle small $$$a[i]$$$ values efficiently, I precomputed a Range Maximum Query (RMQ) Sparse Table. For each $$$i$$$, I jump through the array in steps of $$$a[i]$$$. In my search loop, I check if the 'target value' $$$k$$$ (which is the value $$$a[j]$$$ would need to be to satisfy the equation) is less than or equal to $$$m$$$ (the maximum value in the suffix range $$$[i+1, n-1]$$$).

      Essentially, the condition while (step <= max_in_range) prunes the search space dynamically. If the required $$$a[j]$$$ is already greater than the maximum element available in the remaining range, I break immediately. This turns the 'small $$$a[i]$$$ case' into $$$O(1)$$$ or $$$O(\text{very small})$$$ work, avoiding the $$$O(n\sqrt{n})$$$ case-split entirely!

      Submission

    • »
      »
      »
      2 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it 0 Vote: I do not like it

      I think this solution is quite hard for that level.

      My solution :

      1. We have a[i] * a[j] = j — i < n, so there a[i] <= sqrt(n) or a[j] <= sqrt(n).

      2.We will fix the value of a[i] first -> x, then iterate over j : i = j — a[i] * a[j], just check is a[i] = x.

      3.Now do the same thing with fixing a[j] and iterating by i, here we have a problem that pair where a[i] and a[j] <= sqrt(n) are overcounted, so we just add condition that a[i] need to be > sqrt(n).

      4.Time Complexity O(n sqrt(n))

      5.Submission link : 362679365

»
2 months ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

for C2 was the intended solution to just simulate dfs using the queries and use dp to store how many paths start at each node (and use the dp values to know which query you should make to find the neighbours of the current node)? i got so many WAs

»
2 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

Thank you for this contest, problem $$$E$$$ in div2 was amazing!

First time to solve 6 problem in div2 ^_^

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

One of my worst performances on Codeforces. 1A/2C was an amazing problem. I wish to be able to create creative problems like that.

»
2 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Expected rating for the Div2 D problem?

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

this used to be a dumb question

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I guess, O(nm / 64) was not the expected solution for E2?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

in 1e1, I enumerating at each transition, which position to modify next and what character to change it to, and then determining how far the resulting string can be matched.

To compute this matching, I implemented an algorithm with a complexity of ( log^3 ): I binary search on the answer, then perform a binary search on positions in the suffix array, and when comparing with a certain suffix in the suffix array, I further binary search on the LCP length.

The overall time complexity is like O(26mlog^2mlogn).

However, it runs extremely slowly in practice.

Is there any possibility to optimize this approach?

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    We can except binary search for answer just check in for, and in summary it will be $$$O(m)$$$

»
2 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

how to solve 1A

  • »
    »
    2 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it 0 Vote: I do not like it

    Bob can win only if there is $$$1 \lt = k \lt = min(p / 2, q / 3)$$$ so that $$$p - k * 2 = q - k * 3$$$. If $$$p \gt = q$$$ such $$$k$$$ does not exist, otherwise, if it exists, we can find it using binary search.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +23 Vote: I do not like it

    Bob can keep the difference $$$q-p$$$ constant. Given this, if $$$p \gt =2(q-p)$$$ then no matter what Alice does, Bob can force the fraction $$$\frac{2(q-p)}{3(q-p)}$$$ eventually. Otherwise Alice can always outrun it.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    The final fraction must be $$$2k / 3k$$$, for some $$$k$$$, and the remainder $$$r$$$ must be $$$0$$$.

    So, $$$2k + r = p, 3k + r = q$$$ which on subtracting, gives us $$$k = q - p$$$, and $$$k$$$ must be $$$ \gt = 1$$$ and $$$r$$$ must be $$$ \gt = 0$$$, if it is, then Bob will win (since he can just decrement the opposite number of what Alice decrements, and eventually you will reach $$$2k / 3k$$$).

    Else Alice wins.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Keeping TLEing on test 38 for E1, not sure if my suffix array computation is too slow or the algo is too slow... Is test 38 maybe alot of tests but small n?

»
2 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

There was a problem same as 2D/1B

This is the reason why I can solve so fast 1830B

»
2 months ago, hide # |
Rev. 2  
Vote: I like it -37 Vote: I do not like it

I have feeling that F (Double Bracket Sequence) is just implementation and nothing else.

»
2 months ago, hide # |
 
Vote: I like it -38 Vote: I do not like it

stop graphz problems, pls.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +15 Vote: I do not like it

    What should be asked then, Nursery Rhymes? Stop acting as if Graphs is not a topic tag on CF. Some have problems with DP, some with Geometry, some with Interactive and now Graphs.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Div1B/Div2D is a fun problem, I wonder if there's a solution in polylog? I really appreciate if you can tell me.

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I don't think O(nlogn) solution is achievable.

    during the contest I tried harmonic series, but this O(nlogn) solution only works if the input constraint is changed. exp. the array is a permutation.

    • »
      »
      »
      2 months ago, hide # ^ |
       
      Vote: I like it +6 Vote: I do not like it

      With Harmonic Series , It would've been O(N^(3/2)lg(N)),definitely TLE , The most optimal I could Come across till now is O(N^(3/2)) itself

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

A funny round,except for 1D/2F.

»
2 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Can someone explain the solution to problem 2F/1D

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it +16 Vote: I do not like it
    Solution

    P.S. Sadly, I finished implementing this only a few minutes after the contest, otherwise I would've solved all of the tasks :(.

  • »
    »
    2 months ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it
    Proof
»
2 months ago, hide # |
 
Vote: I like it +196 Vote: I do not like it

this is absolutely legendary…

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Good quality questions, enjoyed the d2 contest, thank you!

  • »
    »
    2 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    How do you practice?

    • »
      »
      »
      2 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Random solving of problems with my rating + 100 — 200. I dont see editorial much, and I think practicing regularly is key.

      • »
        »
        »
        »
        2 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Thanks for sharing!! But how does not going through editorials help.

        • »
          »
          »
          »
          »
          2 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          I do see editorials, either after solving a problem, or after being stuck on it for hours. I Just try to spend a lot of time on the problem, though people recommend limiting it to ~ 40 mins before seeing the editorial.

»
2 months ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

At First I got TLE for in Div2D trying bruteForce....Then Got the idea to divide it through √N....Then I divided them via occurance with respect to √N...solve them each...and Conquered that

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

When will the Editorial be released?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

If hacks were disabled for taks A to D in DIV 2 , then why after the contest a new test case 21 was added in task D. Contest submissions were only judged till 20th test case. The same code that was accepted in contest now gives TLE on test case 21.

»
2 months ago, hide # |
 
Vote: I like it +5 Vote: I do not like it
»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Thanks for the sqrt problem!

»
2 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

I believe the memory limit of E2(div1) is too small. You will immediately get MLE if you build two SAMs.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

https://mirror.codeforces.com/contest/2197/submission/362520586 Why my solution of D passed? It should be tle. When all a[i] = 1, the time complexity is O(n ^ 2), isn't it?

  • »
    »
    2 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it +1 Vote: I do not like it

    Not really.

    In case of When all a[i] = 1, the "for (int j : pos[m / i])" will be triggered only once.

    keep in mind that the outer loop loops through the multiples of some arbitary number i that must exist in 'a' and has to be less than n due to the fact that j-i < n

    Nice solution btw

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

When will the editorial be available?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

for div 2 b i was thinking like that there shouldn't be a cyclic dependency between adjacent values, like Pi can use either (A(i+1) or P(i+1)) or A(i-1) or P(i-1) whichever gives it equal value, and since i will be moving from left to right, i can safely assume left side would have correct matching P and A values.
~~~~~ if (i + 1 < n && (a[i] == a[i + 1] || a[i] == p[i + 1])) { mpp[i] = i + 1; } else if (a[i] == a[i — 1] || a[i] == p[i — 1]) { if (mpp[i — 1] == i) { flag = false; break; } else { mpp[i] = i — 1; } } else { flag = false; break; } ~~~~~ but im getting wrong answer on tc 2 itself... can someone help to find me the issue in this approach?

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hey everyone!

can anyone tell me where could I get solutions for the questions of contest

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

It's so sad that I failed E1 and E2 just because I couldn't find a correct suffix array template :(

I used an old version of ecnerwala's template (which I didn't know was not up to date) and it's actually wrong

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

After careful consideration, I decided to sleep

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

For Problem D The idea of the "sqrt decomposition" works on a very similar problem too: https://mirror.codeforces.com/contest/1541/problem/B

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello codeforces students!

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello, I received a plagiarism warning for problem 2197E2 and would like to clarify my approach.

The query function and output formatting are unchanged from E1, as the interactive protocol is exactly the same between E1 and E2.

For E2, I independently extended my E1 solution by switching from a binary-search-based approach to a recursive DFS-style exploration. The idea is to incrementally query paths, extend edges when prefixes match, and skip already explored subtrees using cached subtree path counts.

This recursive construction with subtree-size skipping is a standard and natural approach for interactive tree reconstruction problems on Codeforces, and due to the strict interaction rules, the core logic inevitably has limited structural variations.

I used my own personal template and did not view or share code during the contest, nor did I use public IDEs or external tools.

I fully respect the Codeforces rules and understand the need to investigate similarities. I am happy to explain my reasoning further if needed.

Thank you.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hello, I received a similarity warning for my submission for problem B.

I would like to clarify that I solved the problem independently during the contest. I did not view or share any code with other participants and did not publish my solution anywhere during the contest. The approach I used is a straightforward two-pointer/greedy style solution, so similar implementations may naturally look alike.

Please let me know if any additional information is required.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Editorial when

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hi, I received a plagiarism warning for my submission for problem 2197F.

I would like to clarify that I did not copy any code from other participants, nor did I intentionally violate any contest rules. I wrote my solution independently based on my own understanding during the contest.

I am fully willing to provide further explanation of my solution if needed.

Thank you for your time and consideration.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can i submit the same code from two of my different accounts on the same contest to increase the rating on both the accounts as my submissions are being removed for the contest.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hi, I received a plagiarism warning for my submission for problem 2197E1.

I would like to clarify that I did not copy any code from other participants, nor did I intentionally violate any contest rules. I wrote my solution independently based on my own understanding during the contest.

I am fully willing to provide further explanation of my solution if needed.

Thank you for your time and consideration.

»
2 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I got this message from the codeforces system that says I have cheated on the Codeforces Round 1079 (Div. 1) (2196) round, which causes my Hmzaawy account to be disabled:

Codeforces System message:

Attention!

Your solution 362496700 for the problem 2196C2 significantly coincides with solutions Hmzaawy/362496700, AarushIITM/362524720. Such a coincidence is a clear rules violation. Note that unintentional leakage is also a violation. For example, do not use ideone.com with the default settings (public access to your code). If you have conclusive evidence that a coincidence has occurred due to the use of a common source published before the competition, write a comment to post about the round with all the details. More information can be found at http://mirror.codeforces.com/blog/entry/8790. Such a violation of the rules may be the reason for blocking your account or other penalties. In case of repeated violations, your account may be blocked.

I have nothing to say, except I do not know this guy, nor have I cheated from anyone, nor have I used any YouTube, nor Telegram, nor used AI to solve the problem and did not use any online compiler!

I did not violate the rules of the platform by any means.

What is required from my end to prove that I did not cheat?

Please keep in mind that this is just a Temporary account!