Jamshed11's blog

By Jamshed11, 3 months ago, In English

Hello Codeforces !!!

I am very excited to invite you to participate in Codeforces Round 1081, which will be held on Feb/21/2026 17:35 (Moscow time)! You will be given $$$\mathbf{2}$$$ hours to solve $$$\mathbf{6}$$$ problems. This round will be rated for all participants with rating below 2100.

This is my first time hosting an official Codeforces round, and all the problems are authored by me. I hope you will enjoy the round.

This round would not be possible without the help of the following people:

Score distribution: $$$500−1000−1250−1750−2250−3000$$$.

Good Luck & Have Fun !

UPD 1: Editorial

UPD 2: Congratulations to the winners:

Div 1:

  1. maspy
  2. peti1234
  3. StarSilk
  4. Rubikun
  5. potato167

Div 2:

  1. XtremeXSPC
  2. WithYoshino
  3. Dom_inic
  4. koukirocks_so_cute
  5. aaa_Pigeon2
  • Vote: I like it
  • +362
  • Vote: I do not like it

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

As a tester I wish you a lot of positive delta!

»
3 months ago, hide # |
Rev. 4  
Vote: I like it 0 Vote: I do not like it
  • Congratulations on your first official round!
  • I'm really looking forward to it.
  • Hope I can reach Pupil after this contest.
  • Thanks for organizing, and best of luck!
  • »
    »
    3 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I just saw your profile. I truly appreciate your tenacity. I guess the coding gods will surely have mercy on you someday, and you will rise to Master. To do these many problems is very good.

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

I am a newbie, but I’m excited to solve and explore problems.

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

I have my University Exams from Monday still I choose to give This Contest : ) All the best Everyone!

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

I have my University Exams from Monday still I choose to give This Contest :

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

I hope i will reach CM after this round!

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

cheater's wont be sent into cry's basement? is it full already?

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

    I suppose we can send them to your basement instead.

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

    Sadly, cry only has enough space to fill the div3 + div4 + USACO + CerealCodes (once that happens) cheaters, and CodeForces isn't paying him enough to host all the other cheaters.

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

Hope to reach my highest rating!

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

Congratulations on your first official round! Really Excited !

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

Congratulations on your first Div2 official contest,Truly inspiring,and excited !

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

Hello evry body!

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

Really Exited

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

Huge congratulations on hosting your first official Codeforces round ! Truly inspiring !!

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

I came for P=NP, stayed for emotional trauma.

»
3 months ago, hide # |
 
Vote: I like it -59 Vote: I do not like it

Don't forget to rename your nameless round:

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

    Yeah downvote me all you want, that won't change the fact that I will rank up to expert after this easy round ;)

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

      Why you are so jealous, I know you (who are downvoting) have lower rating than me but this is reality, you can practice all you want and better luck next time ;)

      • »
        »
        »
        »
        3 months ago, hide # ^ |
        Rev. 4  
        Vote: I like it -64 Vote: I do not like it

        Look at what you've done! My contribution reach negative 2 digits!!!

        Now the system only allow me to post four comment for each hour and one post for each 10 minutes because of your idiot single cell brain downvoting me!!!

        EDIT: This means that I need to wait ~19 minutes before I could post next comment!

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

      How is ur easy round + expert brother?

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

        It is ruined because of the damn downvoter. I didn't expect the mental pressure affected my performance this much! But nice round anyway, I should be able to solve up to D (given time constraint) if I'm not pressured like this. Better luck next time to me ;)

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

          U didn't expect the mental pressure, but u did write the "that won't change the fact that I will rank up to expert after this easy round ;)". Alright..

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

            Yeah, I did, that was mistake, but I will definitely reach expert rank sooner than you! mark my word ;)

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

              Ahahahaha, I'm not even arguing with u :D Have fun and gl

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

                Nonono, don't give up so soon x) You can prove me wrong again if you able to reach expert before me :D Please make it happen and message me again! Good luck ;)

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

    Actually, I have intent to help, but no one appreciate it, seems that it's easier to become evil than good, alright, no more helping people!

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

      If you don’t want to help because they did not show gratitude, then you never truly wanted to help them, you only wanted their gratitude.

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

        I can't reply you instantly because of stupid post limitation because of negative contribution :(

        I didn't want their gratitude, they downvote me, than it means I receive hate for helping people! It's different than gratitude (upvote). Anyway I'm tired to be nice, I'm evil now, I downvoted your comment btw:

        sorry but at least you may know a bit about my feeling :')

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

So excited for this one

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

Feeling proud that our alumni are organizing an international-level contest!!

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

E

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

It feels illegal to have all of the best testers in your first contest...

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

Congratulations on your first official codeforces contest !! Really excited for the contest !!!

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

Planning to start back CP after 4 years gap... Hope this round goes goooood.

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

good luck everyone :)

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

Wohooo! Kudos on your first CF contest :D

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

you lox chyo pishesh eblanka

»
3 months ago, hide # |
 
Vote: I like it -13 Vote: I do not like it

I cant believe he is graduate of same College as mine **__**

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

Was the contest shifted? Could have sworn I saw 20th and not 21st

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

I wonder how to become a tester, that sounds cool.

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

Hiii its one of my first Div 2 contest and also Kotlin Heroes. I saw that this time Div 2 shares the same time with Kotlin practice, i wanna know if i can join both of the contest or just one only. I would be much appreciate if anyone can answer this for me and also have fun coding :D

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

    You can join both but this 2 hours rated contest is much more important than unrated "kotlin practice" contest that runs for 9 days!

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

    Kotlin Practice is a mashup contest consisting of already known problems, it also runs for 9 days and is unrated. Additionally, I'm pretty sure that while this contest is going on, you won't be able to submit to the Kotlin practice round.

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

Congratulations on your First Official CF Contest!!

Really excited for the Contest!!!

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

Congrats on hosting the round!!

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

if all goes well i'll be giving div2 after long time. i'll try to solve at least 3 problems today inshallah. Ramadan Kareem

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

General announcement

This is an Emergency Alert Broadcast by Codeforces.

Some hackers have broke into our beloved website, we are currently investigating this scene.

Some users may not receive this announcement, so write a blog/comment/message to alert those users.

Meanwhile, do not submit any code until further notice.

Stay calm, do not panic.

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

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

Can 79XD get +100 points for successfully hacked (wa) to CF? Let's figure it out.

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

Hope to get some positive delta after a long time.

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

If whole cf was hacked were the problems also leaked?

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

    the announcements were caused by someone sending them through a mashup contest, which somehow were sent to all users. all the "hacker" did and could do was send announcements. no problems were leaked, contest should be fine

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

YEEEEES

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

Will this be put off?

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

Is this round happening like normal or hackers are still here on the website

»
3 months ago, hide # |
 
Vote: I like it -16 Vote: I do not like it

Bro RAMADAN KAREEM

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

Hope I can solve problem D and get a high score ! Also best wish for everyone :)

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

Will this contest happen at its usual time or not? I will take the leave from job if happen else will go for job.

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

i forgot to registration but its showing Before extra registration how can i register

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

absolutely no fun

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

stop graphz pls

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

A-E were all boring and oppressively uninspired

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

How to solve D?

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

    Think of dp.

    dp[v][0] -> Maximum cost of the subtree of node v without doing the operation. dp[v][1] -> Maximum cost of the subtree of node v with doing the operation.

    and try to calculate dp[v] from it's children dps.

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

    Using Tree DP. As, for every vertex $$$u$$$ its maximum answer would be either by replacing one of its complete child subtree at maximum depth OR don't move any subtree at all OR use any already altered child subtree of $$$u$$$.

    CODE : 363901543

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

    greedy, the best move for node i is move one child of i to leaf of another child of i, or best move of childs of i

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

Problem E exists on Codeforces with the exact same solution and it is recent, like why ?

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

Excited to know the solution of problem E! Anyone?

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

Wow is python great for speedforces. I probably would have been fighting one-off errors on B/C the entire contest if i used C++. Got to actually work on problems at my skill level

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

Problem statement for $$$D$$$ was the worst. Took me so long to even understand the operation.

Can someone take a look at my solution for $$$D$$$? Wrong Answer on test 3. I don't know what's wrong.

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

    i had a similar error with what i was doing in

    ans[u] = max(ans[u], ans[v] + sum_a[v])

    You should use the sum of val[v]+sum_a[v] for all children v, thats because you should still be counting the "default" values for other children

    Look what I did

    ans[u] = def[u];
    int sumdef = 0; // my def is your val i guess
    for (int v : ch) sumdef += def[v]+sum[v];
    
    for (int i = 0; i < ch.size(); i++){
        int mxd = -1;
        int v = ch[i];
        ans[u] = max(ans[u], sumdef-def[v]+ans[v]);
        if (i > 0) mxd = max(mxd, premax[i-1]);
        if (i+1<sufmax.size()) mxd = max(mxd, sufmax[i+1]);
    
        if (dep[v] <= mxd) {
            int cur = def[u] + sum[v]*(mxd-dep[v]+1);
            ans[u] = max(ans[u], cur);
        }
    }
    
»
3 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

wtf a StackOverflowException in C# results in an Idleness limit exceeded verdict

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

For problem E one need to bulid a graph with multiedges a[i] -- b[i] (removing a[i] == b[i]) then split it into cycles (i.e. its possible iff all degrees are even). But ahhh no time

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

How the heck is my solution failing? 363902357

I feel like it's a pretty simple solution + implementation. Simply check how many times you go through all bullets (i.e. theta) and go through elements, swapping min prefix with max suffix.

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

    It can fail when max_suf[i] = a[i]. You are then replacing the minimum with a[i], even though a[i] also stays where it is, thus taking it twice.

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

    yeah as above comment mentions you have to add a if condition to swap only if max after current element is greater than min till current element else you dont.

    Also here is a failing test case for your solution 4 5 10 1 3 1 1

    Expected answer is 3 your solution gives 2.

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

Is my Submission for D recorded or No?? it shows in Queue even though i submitted like 4 seconds before

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

OH NO I didn't correctly implement problem D, is there a more lightweight implementation approach here?

this is my solution: First, handle the corner case where n <= 2.

For the remaining cases, find a root rt such that deg(rt) > 1. Define jmp_i as the first ancestor of node i (among its parent chain) whose degree is greater than 2, or rt itself.

Then maintain the following arrays:

f[i][0/1/2]: The maximum depth in the subtree when rooted at i / The maximum depth in the subtree of another child of i / The maximum depth in the subtree of yet another different child of i.

g[i][0/1/2]: The corresponding child node indices that achieve the depths stored in f[i][0/1/2].

All of these can be computed in $$$O(n)$$$ time using DP.

After that, for each node i, first jump to jmp_i, Using the preprocessed f and g arrays, brute-force classify into four cases and compute the optimal answer.

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

    Yes, for each node calculate:1.max cost,2.sum of values of nodes in its subtree, 3.depth of deepest node in subtree of that node. Now look, for each node, either we dont do the node shifting op or we shift a child node to deepest node of siblings or we shift a node in subtree of child node within it. All three can be calculated using the 3 things we calculated for each node. Take max of all these cases to find the max score for a node

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

363903833 I tried backtracking for E (as a last-minute approach) but it got WA2. Can anyone tell me why?

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

WTF ?

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

did everyone face long queue issue or only the ones who submitted in m1.codeforces.com?

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

why can't I make hacks ?

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

I enjoyed D problem a lot. Tree Dp was good.

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

ABCDE are perhaps even too easy. Not that I actually got all them solved during contest although :)

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

flipforces

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

I couldn't figure out E was

Spoiler

Great problem-setting on this one :)

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

Am I the only one here got stuck with C and then didn't have enough time to solve D=(((( I had the right idea but not enough time to implement it. E did saved my rating, but I still feel not good since I could have solved both D and E and got positive delta. Hope to come back again in CF Round 1082 :v