kingmessi's blog

By kingmessi, 5 months ago, In English

Good day Codeforces ✨

We are excited to invite you all to Codeforces Round 1067 (Div. 2), starting at Nov/29/2025 17:35 (Moscow time).

This round features 6 problems to be scored in 2 hours, with a few problems including multiple parts. All tasks were authored and prepared by koderkushy and me. This round will be rated for all participants with rating below 2100. Take a look at all the problems, we hope you enjoy the challenge! 🚀

We extend many thanks to our team for helping make this round possible:

Score Distribution: $$$500-1250-1500-2000-2750-(2500+1000)$$$ 🏆

UPD: Congrats to the winners!

Kudos to antontrygubO_o for almost getting to the intended solution of F2 in contest!

UPD 2: The editorial is out.

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

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

Ein Zwei Drei

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

:gif (failed loading) T-T , excited to solve again !

»
5 months ago, hide # |
 
Vote: I like it -7 Vote: I do not like it

As a commenter, I commented very fast!

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

    As a watcher , I always watch you comment fast (~ ̄▽ ̄)~

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

    As a singer, I released a new song very fast.

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

Messi Gif is amazing, buddy.

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

I was one of the testers for this contest, so I’ll leave my mark here.

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

Messi is peek

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

I'm a Ronaldo fan, may I participate in this contest

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

messi, my beloved

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

I was one of the tester who did not test ^_^

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

I need to careful about penalty Otherwise Messi can goal.

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

In my opinion, Ronaldo is better.

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

is this a sixseven contest or a messi contest

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

    I think it's a Messi contest!

    but you can participate even if you are not a messi fan!

    Good luck to everyone for this contest!

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

![ ](wallpaper-cr7-cristianoronaldo-foryoupage)

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

As a tester I hope you enjoy the problemset.

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

As a tester, I enjoyed testing the problems.

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

Ronaldo fans accepted?

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

_helloLad orz ^_^

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

Suiiiiii

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

If we avoid penalty, we can goal.

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

It would be amazing if all the problems were related to football or Messi.

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

What does the score distribution mean? I'm new here and don't know much of the thing. How will these score impact in the contest rating? Would anyone mind explaining please?

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

hope I don't get negative delta like every div 2 i pass xD , Btw cool to post that gif of messi it really motivated me to pass the round !

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

As a tester, I’m just as clueless about the final problemset as the participants ^_^

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

A-500 , B-1250 , speedforces

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

Hope to solve at least 3 problems, thus increase my rating.

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

can you please also mention, if for some questions we have pretest = full test

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

Looking at the score distribution, I smell a hard B.

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

As a participant, Lionel Messi encourages me to solve at least three problems.

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

As a contestant I registered FIRST :D

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

As a tester, I'm commenting late as I'M A FUCKING CORPORATE SLAVE ;_;

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

As a Ronaldo fan I will participate in this contest. I hate pretests!!

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

Oh no, Indian round. Get ready for Math and DP.

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

Ronaldo is the goat today this round will be El Clasico.

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

Little unfair to keep a messi contest on a night when barca plays init ?

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

messssssssiiiiiiiiiiiii yooooooooooo

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

As an Argentine fan, I will always miss Messi. And also Ronaldo .

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

codeforces round $$$1067$$$ $$$6 7$$$

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

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

Will the first one be named goat?

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

__baozii__ strikes back!!

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

Lmao

Eibar man pessi stan

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

I practically never solved a dp problem on my own before but today I passed C. Im happy :)

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

I would love to read the editorial for F1 , it was painful :]

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

Idk bout others,but b was significantly harder than c, I solved c in 20 mins of seeing the question while b took forever. Whole time i was trying to split even Freq numbers manually in such a way that they get split into two odd parts.

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

    Yeah What was your approach after that? I realised that if there are no odd occurences than we can only split the even occurences among two if the number of even occurences have the same parity as n. If not than there would be a even occurence we can't split and so my code became like this:

    if you found an odd occurence add 1 to ans if you found an even occurence add 2 to ans

    if there are no odd occurence than check whether parity of number of even occurences is same as n. If it is than subtract 2 from ans.

    Finally output ans.

    This was my solution for b but I could not solve C can you tell me how you solved it? I was able to deduce that if k is even than we simply calculate the maximum subarray sum using kadane's but when k is odd than we can change 1 element of a[i] to a[i] + b[i]. But how do you go about doing this optimally in o(n) or in o(nlogn). I was stuck here...

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

      Assume two variables, storing max subarray sum ending at the current pointer, one of without selecting some b element, and of with some b element selected and apply something very similar to the standard algorithm for max subarray sum.

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

Am I wrong, but I think D can be solved in O(n)?

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

    convert both strings into the zero string, reverse the order of instructions to get the 2nd string.

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

    Of course it can be solved in O(n). But $$$n\leq 100$$$ makes it easier to implement.

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

      or maybe because of the checker? is there any way to check if the output correct or not faster than O(n^2) ?

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

        This makes more sense

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

        It can be done with hashing + lazy segment trees. On a node of one segment tree responsible for [l,r] we keep a polynom hash of s[l...r], on the second segment tree we keep a polynom hash of reverse of s[l...r]. When inverting hash changes from s[l]+s[l+1]*p+s[l+2]*p^2+... to 1+p+p^2+... -(s[l]+s[l+1]*p+s[l+2]*p^2+...).

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

          you are my hero,

          but how you are going to handle the update

          imagine you inverted the range (l,r) , and now you have a range to check (l2,r2)

          where l2 <= l <= r2 <= r, how you are going to check, the update function in segment tree needed to be Polynomial queries.

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

            We maintain a boolean flag whether an inversion operation should be done on a node or not. Since doing two inversions is the same as not doing any operation at all, while propagating we do child_flag = child_flag XOR node_flag.

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

    I also solved D in O(n). You can always use 3 bits to flip the first one in at most 2 operations. This way you can adjust all bits, but the last 2. For the last two I did a BFS over the last 4 bits of the string. n being bigger or equal than 4 seemed to hint that this was the wanted approach. (I have no proof though, that the last 4 bits are enough or that it does not use too many operations for the last 2 bits)

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

      could you elaborate on the bfs part on the last 4 bits, i could figure out the next 2 bit logic during round, but couldnt figure out what to do with the last two bits

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

        Sure, you can look at my submission here:

        351233260

        This Part:

        You must imagine this BFS a bit more abstractly. Every node is 4 bits. So $$$0000$$$ is a node, and $$$0101$$$ is also a node. And we connect two nodes with an edge, if there is an operation that transforms the string into the other. So $$$0101$$$ and $$$0010$$$ would have a common edge, because we can flip the last 3 bits by the rules. $$$0000$$$ and $$$0100$$$ have no common edge, because we cannot apply this palindrome rule directly.

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

    Yup, there's a few solutions. My solution first brute-forces the $$$n = 4$$$ case. After that, I go from left to right in both strings (to the point $$$i = n-4$$$) and if they differ, fix the difference by doing small local changes — either a length $$$2$$$ change if $$$s_i = s_{i+1}$$$, a length $$$3$$$ change if $$$s_i = s_{i+2} \neq s_{i+1}$$$ or a length $$$2$$$ change on $$$(i+1, i+2)$$$ followed by a length $$$3$$$ on $$$(i, i+1, i+2)$$$ if $$$s_i \neq s_{i+1} = s_{i+2}$$$. After that, the strings are identical besides the last $$$4$$$ positions, the solution for which I get from my initial brute-force search and shift the indices.

    The reason it works is that I make at most $$$2$$$ operations for each index except the last $$$4$$$, and I verified that my brute-force approach takes at most $$$8$$$ operations on the $$$n = 4$$$ case, so I get a total of at most $$$2(n-4) + 8$$$ operations as desired.

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

      One could also just split the strings up into blocks of $$$4$$$ (where the last two may overlap) and apply the brute-force solution to each block.

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

Please Someone explain me how to solve B?????

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

    it was ultimately how to divide elements having even frequency ... because however you divide odd frequency it can only contribute +1 to the answer

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

    Numbers having ODD freq. will always contribute at max +1 to the final score, whereas EVEN frequency either contribute +2 or +0 only. Also, we can split any odd number = A + B, where |A-B| = 1, eg. 7 = 4 + 3. Also, these "1" are always even in numbers (as, sum of freq = 2*n, i.e. EVEN) so they can be distributed easily, to either set 'P' or set 'Q'. Now, for even to contribute +2, either even/2 = odd, or leftover evens, i.e. those evens where, even/2 = even number, can contribute +2 only if either even no. of such even numbers are present or either atleast we have 2 or more +1 deviation that we got from odd frequency. else one +2 won't be considered into our answer; Though a bit of casework but this is what i wrote in my code, if anyone have a simpler solution do share :)

  • »
    »
    5 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    1. You will take all the odds. There is no point of leaving an odd freq. Contribution of odd is 1.
    2. You will leave at most 1 even. This depends of the parity of n and even freq. The parity should either be same or there should at least be 1 odd freq to fill the parity gap. Even contributes 2 (odd+odd = even)

    Final answer: ans = odd + ((n - even) % 2 == 0 || odd > 0 ? even : even - 1) * 2;

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

I dislike problem D very much, uninspired and annoying

Problems C and E are cool though

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

Because of the error of D checker, my wrong code past the PP,then I go to solving the E ,it taked me 1h, when I see the D error ,it only have 3min. I have no time to change it. It was so upset.I vote down...

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

fuckass palindromes

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

shit,I'm terrible.I can only finish the first two questions.

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

Good round but $$$D$$$ is too hard for me :(

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

God damn that was brutal, I need to practice more.

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

Problem D is so bad lol

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

whyyyy the fuck i cant submit 1 second late

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

cooked by B again... I kind of saw C immediately ... for me B >> C

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

Why there are annoying implementations on D nowadays??

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

shit B

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

Any ways for us to sumbit new solutions after the contest has finished?

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

How did so many people get C. It looked like there were lots of cases or am I just stupid:/

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

    If k is even, just output maximum subarray sum Else, You can just get the Kadane prefixes and Kadane suffixes and try all indices, get the max

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

      Damn I had a feeling that the answer won't change for even K but I couldn't prove it and was thinking about edge cases. Maybe if I had not wasted so much time on implementing B i could have got it.

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

      For odd k, I did a dp where dp[i][0] is the maximal subarray ending at i without adding an element from b and dp[i][1] is the maximal subarray ending at i with adding an element from b. Then your answer is just the maximum over all dp[i][1].

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

    if k is even then alice cannot increase the maximum sum since bob can always undo the operations. similarly the sum cannot be decreased. so the problem is just to find maximum non empty subarray sum which is standard kadanes algorithm. for odd k, bob will always undo alices move until the last move which alice will play. now the question reduced to finding the maximum subarray sum such that alice can perform one operation. just a slight variation of kadanes algorithm, which could be done with DP.

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

      But how can we claim that undoing alice move is the best move for bob?

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

        Cause on Alice turn he would make sure that Bob's best chance is reduced, cause by saying Alice trying to maximize, we also mean that Alice makes sure that Bob score is also reduced, cause reduced BOB score = increased ALICE score! Though it's not a formal proof, but if anyone have it please share

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

        didn't prove deeply... but then alice can keep undoing what bob is doing LMAO !!!!

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

          Alice is the one to start so, he is never the one undoing Bob's move. Instead Bob is the one who is obliqued to undo Alice move.

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

            I was saying if somehow Bob had better move, then Alice can keep undoing it later after Alice made the first move ... sorry for confusing statement by me

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

          If k is even, bob and Alice will keep going back and forth and the array will just stay the same, so we just have to find the maximum subarray sum in the origianl list. For the k is odd case, my solution was ngl really ugly, but basically I created an array of the cumulative minimum prefix sums from 1 to n, then an array of the cumulative maximum prefix sums from n to 1, so for each element b_i I found maxes[n-i-1]-mins[i]+b_i, and kept updating a final max variable so that is was the maximum value of maxes[n-i-1]-mins[i]+b_i over all i.

          My code:

          https://mirror.codeforces.com/contest/2158/submission/351223312

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

        Because the optimal move is same for Alice and Bob.

        Consider any maximum subarray, obviously Alice will add max $$$b_i$$$ in that subarray, and so now for Bob also it is optimal to decrement the same $$$b_i$$$ and not anything else.

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

        Because

        $$$b_i \geq 0$$$
      • »
        »
        »
        »
        5 months ago, hide # ^ |
        Rev. 2  
        Vote: I like it 0 Vote: I do not like it

        One way you can show this is by showing that when k is even Alice can always maintain the sum for the maximum subarray sum (MSS). Hint: Consider the maximal b[i] in the range of the maximal subarray sum.

        This would show that the answer is >= MSS, but you also have to show that it is <= to the MSS which is quite simple to do as well. Let me know if you want the details.

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

"Power outage won the battle but not the war." Atleast i solved A and i will accept my negative delta.

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

DSU rollback came to my mind while thinking about problem E, but I wasn't confident enough to think it is actually true because DSU rollback doesn't appear frequently.

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

: — )

»
5 months ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

dear god i really hope the next div has DFS or even DSU

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

Why can’t Problem B be solved using a frequency array?

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

    It is solved using a frequency array. Don't know if there is another way to solve it.

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

      here is my code ~~~~~

      include <bits/stdc++.h>

      using namespace std;

      void solve() { int n; cin >> n;

      vector<int> a(2 * n);
      for(int i = 0; i < 2 * n; i++) {
          cin >> a[i];
      }
      
      vector<int> freq(2 * n + 1, 0);
      
      for(int x : a) freq[x]++;
      
      int even = 0, odd = 0;
      
      for(int i = 1; i <= 2 * n; i++) {
          if(freq[i] == 0) continue;  
      
          if(freq[i] % 2 == 0) even++;
          else odd++;
      }
      
      cout << odd + even * 2 << "\n";

      }

      int main() { ios::sync_with_stdio(false); cin.tie(nullptr);

      int t;
      cin >> t;
      while(t--) solve();
      
      return 0;

      }

      ~~~~~

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

great contest

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

I am cricket lover

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

Terrible perf these past two contests :(

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

    You can use BFS to check the operations for the last 4.

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

    I did this, bfs all possible masks for n=4,n=5,n=6,n=7, you can get any sum , s >= 4, with these 4, and i cut the string into parts of (4,5,6,7) and each part i can solve easily because i stored already the soultion for (4,5,6,7) .

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

    For s = 1010101, t = 0101010, pushing till the last 4 positions yields s = 0101011. How to make the last 4 bits 1011 into a 1010?

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

      1011 -> 1000 -> 1111 -> 0000 -> 0110 -> 1010

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

      For my implementation, pushing till the last 4 makes: $$$0100101$$$

      Anyway, here is the output from my code for the last 4 bits you mentioned:

      Input:
      1
      4
      1011
      1010
      
      Output:
      5
      3 4
      2 4
      1 3
      1 2
      2 4
      
»
5 months ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

Great problems!

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

Great contest!

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

Why it is showing unrated in my profile?

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

from my pov B is harder than C =))

»
5 months ago, hide # |
 
Vote: I like it +19 Vote: I do not like it
Easy implementation idea for D
»
5 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

To solve C, I would use a segment tree to avoid any overthinking if possible. Same goes for yesterday's E.

https://mirror.codeforces.com/contest/2158/submission/351205345

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

Can someone explain B?

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

    Don’t have to think much, for odd values just do ans++. For even values, just split them into two close odd numbers. If they can be added to c1 and c2, then do ans += 2 also if(c1>=c2) c1+=max odd and c2+=min odd else c1+=min odd and c2+=max odd

    my thinking was i can split odd how every i like so just splitting even like that i can end up to size n by adding odd parts

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

When I finally got Candidate Master omg >///<

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

Problem F is very similar to this problem: https://mirror.codeforces.com/contest/1981/problem/D

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

For D, I precalculated $$$ops[16][16]$$$ which gives a sequence of operation for a all 4 length strings represented as masks. Then we can directly reduce the string $$$s$$$ to $$$t$$$ till $$$n - 4$$$ positions and then use these operations for the remaining 4 digits. 351229248

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

Is there a way to hack own solutions after the contest? I think editorial solution for E is wrong, even though it passes tests, as it doesn't do proper DSU rollbacks.

on grid like

100 100 1 100 100
5 5 5 5 5

if we reduce the middle 5 by 1, and then reduce all other 5 by 2, they will still have min neighbor = 1, even though the picture is now

100 100 1 100 100
3 3 4 3 3
  • »
    »
    5 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    If someone is interested, I figured out this does not break the solution because:

    1) if we had to decrease 5->3, we shall create a new node anyway, so last one is not used 2) if we don't decrease the value, the 5->4 decrease makes the adjacent components non-final anyway.

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

I figured some people might be interested, it is possible to solve problem D in linear time.

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

Nice round.ABCD are natural and E is absolutely a beautiful problem

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

In Problem F2, I wrote a randomization program and found 100 numbers with pairwise distinct gcd values.

randomization program

The probability of this randomization program succeeding was low, but I was lucky enough to stumble upon one such set of numbers.

After obtaining these 100 numbers, the construction method for this problem is the same as in CF1981D.

The submission

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

Good contest, love from China.

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

I had fun participating :) looking forward to the next one hehe

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

the question C's solution is wrong because for this test case: 2158C - Annoying Game

1
3 3
2 -7 3
1 -10 3

alice will not add -10 but subtract it so with your solution the final array is 2 -7 6 ans: 6 but the answer should be 2 3 3 ans: 8 i think you should update it and if can update the solution of this question @kingmessi

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

Enjoyed the round — though seeing Messi on the cover made me feel like I needed GOAT-level skills just to pass pretests.

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

so this was a div2 contest.. should winner list include div1 people ??

generally there is a list which contains only div2 winners..

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

ankara messi....vamos argentina

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

how to think for problem like d

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

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

Thank you for giving me such a great rating, Now waiting for contest 1069 to finally match my rating

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

I received a warning for 351215259 for the problem 2158B saying my code matches with SupremoCoder/351200134 My code is not the same — I used a map-based approach, while the referenced submission used a frequency vector. I did not share my solution with anyone or collaborate. I can explain my entire thought process and show intermediate versions of my code if needed. This similarity might have been caused by the problem's deterministic logic. Please review my case.

This is a proper misuse of contest rules

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

enjoyed the contest