Intellegent's blog

By Intellegent, 11 months ago, In English

Hi Codeforces!

I am very excited to invite you to participate in Codeforces Round 1060 (Div. 2), starting at Oct/19/2025 17:35 (Moscow time).

There will be 6 wowee problems for you to solve in 2 hours, some problems will have multiple parts. All problems were authored and prepared by me. This round will be rated for all participants with rating below 2100.

I would like to thank the following list of very strong individuals for making this round possible:

Score distribution: $$$500 - 1000 - (1250 + 1000) - 1750 - 2500 - (2250 + 1750)$$$

UPD: Editorial

UPD2: Congratulations to the winners!

From Div. 2:

  1. RGB_ICPC3

  2. ljw01

  3. paulo.pr

  4. HusseinFarhat

  5. happyhush

From Div. 1 + 2:

  1. potato167

  2. Geothermal

  3. A_G

  4. arvindf232

  5. maspy

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

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

As a tester, I hope you enjoy the round as much as I did. :)

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

wow wow intellij round i love intellij rounds

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

wowee

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

as a tester, this round reminds me of the good old fish and chips straight from the ponds of great britain.

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

As a participant, I hope to reach CM in this round

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

As a first time VIP tester, I feel very important.

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

As a tester, orz __baozii__.

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

Whenever the problem setter is intelligent, I usually do well in the contest.

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

Hopefully, the problem statement will be short and precise just like the announcement. wowee! <3

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

As a tester, I stared, I ran, I knew, Intellegent's magic coming through.

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

As a tester, orz Intellegent

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

as a tester, i got a little too excited while testing

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

I participated in div3 1059 ,solved 1 and 2 got RE , but i didn't become rated from unrated why is that? ...

»
11 months ago, hide # |
 
Vote: I like it -42 Vote: I do not like it

$$$VIP+$$$ is a clear example of what happens when you use extreme adjectives too often to describe ordinary things. If you actually used these extreme adjectives properly, then a very important person would basically mean a person who made the round possible. Without them, the round just wouldn't happen. That is very important. So what could a $$$VIP+$$$ person possibly mean? There's just nothing really left for it to describe, and it becomes meaningless to people reading it. Also, $$$VIP$$$ loses some of its significance.

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

    did your grandmother lose significance due to your great grandmother

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

      The comparison you're making here doesn't really work, because 'great' in this case doesn't mean what it usually means. Here it means "a generation older than." No one reads it as "a grandmother that's great" because it doesn't mean that.

      This is unlike "very important person" or "legendary grandmaster" as the adjectives here actually describe something I guess you can call subjective in that it's really hard to say objectively that someone is "legendary" or someone is "very important." And because of this subjectivity, people abuse the words and dilute their meaning through overuse.

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

        I know that damn well, I am just giving you an idea that you don't have to comment on literally everything, especially when your opinion doesn't mean jack shit.

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

          yeah chromate00? well the jerk store called. they're running out of you.

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

            Shocking news: american found using ad hominem because there was no other way to logically refute the counterargument

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

              all I see is 2 local clown making entertainment for me before round.

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

                All I see is a spectator seeing 2 local clowns making entertainment before round

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

                  All I see is a spectator seeing a spectator seeing 2 local clowns making entertainment before round

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

                  All I see is a spectator seeing a spectator seeing a spectator seeing 2 local clowns making entertainment before round

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

            What’s the difference?! You are their all time best seller!

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

    I am in charge of refilling the ice cubes during the round to stop the judges from overheating. No need to thank me though :)

»
11 months ago, hide # |
 
Vote: I like it -22 Vote: I do not like it

As a student in China, I want the Codeforces Round be at about 11:30 UTC, so that I can participate it straight after school without staying up late. (Well I'd like someone to help me with C++)

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

sammyuri let's go it's gonna be fun! My favorite tester

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

Happy Diwali !!

Don't get offended.

As an Indian, i have a sad truth, this contest would have the best + because all the cheater are not present at the contest time as they were celebrating the festival..

Good Luck for all :)

Real coders will still give the contest.

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

hope i get to pupil ;-;

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

wrong post sry

»
11 months ago, hide # |
 
Vote: I like it -23 Vote: I do not like it

حبيب البي

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

I'll test soon :saluting_face:

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

It was all going fine until I read ‘You need to process Q queries’.

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

As a tester who forgot to write his tester comment, I hope everyone has fun solving the problems!

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

i hope i get high rating (pls downvote this comment)

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

As a participant, I wish to become CM after this contest

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

hope I can reach expert in this contest

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

    so that we cant tell that you are a cheater ha?!

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

      Right, because Codeforces is the only place where real coders are born. Forgive me, a mere heretic who somehow won an award a full year before——imagine that!——being blessed by this site. Should I have it framed for you to finally consider me worthy?

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

i will solve 4 problems easily inshaaAlah :) wait for the master performence !

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

want to learn so much

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

Intellegent round detected

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

what is the difference between normal , VIP and VIP+ testers?

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

Catshock is a crazy name.

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

I loved debugging and finally solving C2.

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

i could only solve 2 questions :( How do I improve?

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

    same man, 2 problems.. i guess just keep doing contests and upsolving those that you couldn't do — eventually you will come across the same problems again and you will be very happy!

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

    me too :(:(

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

Good A-B-C1-C2. It seems like D easier than C2 but I did not have time left

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

It took so long for me to solve B :(

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

C be like ImpossibleForces

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

fell into the trap of trying to solve C2 before D .. but failed !!!

I realized that my algo was using MAXIMUM_VALUE which is not limited across test cases so TLE

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

What's the idea behind C1? I got it eventually but with 100+ lines of code lol, pretty I missed the simple idea

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

    The answer is at most 2 since you can always do one operation on an odd number to make it even.

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

    the answer can be only 0,1,2 .. so you just check for 0 and 1 .. otherwise answer is 2

    check for 0 .. two numbers have some prime common

    check for 1 .. iterate left to right .. keep all primes seen till current number, but also check by incrementing current number if we have seen some prime factor for that .. if yes.. we can increase current number and do one operation .. do in both direction ( right to left also ) to keep code simple .. I couldn't figure out one pass so did both direction

    else answer is 2 ... in worst case .. we increase 2 odd numbers to make them both even.

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

      well ok, that's what I did, but I was just slow af lol

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

      To "check for 1", you don't need to do right to left. All positive integers x have the property that x and x + 1 are co-prime, therefore you can simply check if (a[i] + 1) has any divisor that was previously saved.

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

        no.. what if like 5,2 . . when I go left to right .. and see 2 .. i have not see any prime factor for 3

        but when I go from right to left and I am at 5 . I check for 6 ( 5+1) ... then I have seen 2 on the right side

        am I wrong in understand your point ?

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

      can someone explain time complexity for this, how taking prime factor for each number is passing? wont this be (10^8)

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

        we need prime factors for a[i] .. which is <= 2e5

        there is a way to do factorization in logN after N log log N sieve to calculate smallest prime factor

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

        2e5 * sqrt(2e5) ~ 89442719.1, which is suitable for running under the 3 second time limit

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

    the answer is <= 2 for sure. then i took the following cases:

    first prime factorize every number and for each prime factor, store the number of distinct elements in A that have it in its prime factorization (can store in map)

    now, if there are atleast 2 even numbers -> answer = 0

    if there is only 1 even number:

    1) go through the map to see if freq of any prime factor is atleast 2, that means there exists two numbers with gcd > 1 -> answer = 0

    2) else -> answer = 1 (since any odd number can be increased by 1 to make it even and now we have 2 even numbers)

    if there is no even number:

    1) go through the map to see if freq of any prime factor is atleast 2, that means there exists two numbers with gcd > 1 -> answer = 0

    2) go through every number, remove it prime factors from the map. increase the number by 1. find its prime factors and see if any of these prime factors already exist in the map -> answer = 1 else put back the prime factors of original number into map.

    3) else -> answer = 2 (increase any 2 odd numbers by 1 and we get two even numbers)

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

Two hours is toooooooo short for the 8-problem round. I have no time to think about E :( Maybe it would be better if there were 2.5 hours.

Btw I initially thought $$$O(17985\min(n\log A,17985))$$$ would pass C2 but forgot to multiply the complexity by $$$T=\frac n{17985}≈11$$$ and got two TLEs and wasted 20 minutes :( Has anyone made the same mistake as me?

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

I couldn't speed up my C2 :(

How do you efficiently calulate minimum operations required where you keep incrementing single element?

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

    I had same issue but managed to find a way out on time...

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

      What's the optimization?

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

        Started with answer= sum of two minimum costs.

        Simply instead of adding only I found out how many additions will it actually take for every element in map (which is just frequency of all factors of all elements other than the one with minimum cost) for element with lowest cost of change.according to addition you will have cost and just compare that with ans.

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

      please tell

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

        There are 4 cases only. 0 ops, 1 ops ,2 ops on different index, more than 2 ops on a given index. you only need to check 4th case on index with minimum brr

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

    You don't need to calulate it.

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

      please tell me that is not truee.... aaaahhhhh!!!

      ok got understanding from this comment

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

      so how to fast solve case ?

      n = 2

      a = 1 big_prime

      b = 1 10^9

      you need to go from 1 to big_prime, so ans = big_prime — 1

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

        frequency map out all the factors of every element in array except the one with smallest b. let's say val is the element with smallest b then for all elements in map find out how much to add in val to get it divisible by map's key and then accordingly compare it with ans. And max bar for answer would be sum of two minimum b.

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

IMO, C1 wasn't worded well

"two integers i,j where 1 <= i < j <= n and

$$$gcd(a_i,a_j)^∗ \gt 1$$$

".

What about the other positions. It wasn't clear if only two positions need to satisfy the above and any pair of other numbers should be co-prime, or if two such positions should exist in the array.

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

What a great contest, probably my best performance ever

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

for problem c1 i submitted correct solution at 48 mins but to verify my solution for c2 i tried submitting other solutions so they are considering the last submitted solution or the first submitted solution ? ( I am fucked)(T_T)

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

wysi

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

Nice problems, although the round was deeply unbalanced, D was far too easy and C2 was much harder. (Unfortunately I spent like 1h30 on C2 just to get 300 points after 6 wrong submissions and didn't even look at D during the contest)

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

Problems A-D1 are good, I think; I could've solved C2 if I had ~5 more minutes. Didn't have time to read E and its solve count is low.

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

Misread C as making all the indexes i,j satisfy gcd > 1 .. Was wondering how that can be done ?

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

I should have moved to D after C1 , D is easier compare to C2 .

C2 is good prob btw. got TLE at 5 :(.

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

Can anyone explain what's wrong in my code for problem B

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

    first part you had done well ,

    but for counting ans,

    you have to only tackle val at odd positions and if b[i]>min(b[i-1],b[i+1]) then you have to decrease b[i] -> min(b[i+1],b[i-1]) — 1 as b[i] should be lesser than its neigh.

    Edge cases -> position( 1 and n )-> where i-1 and i+1 take carefully.

    that it for reference -> check My submission

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

Why did my code on C2 got TLE?

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

struck in C

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

WYSI

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

Hi!! When can I upload sources on the problems again? After the system testing?

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

D statements are the best I've ever seen

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

Teto and OSU reference in codeforces contest?? what in the multiverse...

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

anyone notice on C2 test case number 2?

2
4 8
**41 67**

our brains are shrinking

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

I believe my solution for problem E is incorrect, but it was accepted.more details

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

Test case 21 for C1 is no mercy, I solved C2 btw. Feels bad.

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

    For me it was just that a[i] = 200000 (and answer = 1 or 2) seems to be only in system tests not pretests, even C2 should have failed at my side but seems such system test was not there for C2.

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

Can anyone explain why my code gave TLE on C1. Expected time complexity is about O(nlogn). Submission Link

Thanks

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

please can anyone tell me what is the efficient process to find the minimum add amount to prime i so that any prime j and gcd(i,j)>1 . suppose i have an array of prime number how to find ???I can not use nested iteration.

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

Why do you hate me? :(

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

No one noticed my time complexity issue during the contest.

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

C2 and D were great! Thanks for the contest

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

I really enjoyed this round! The problems were engaging and offered a good mix of challenge and fun. It was a great learning experience. Looking forward to the next one from Intelllegent and hope to improve my performance. Thanks to the problem setters for organizing such an enjoyable contest!

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

thanks for the great round!!. Even though i bricked C1 just because i took array size 200000 instead of 200001..

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

wowwww

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

dislike my comment it's useless anyways

btw my goal is the last place on contribution top

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

.

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

when seeing the first problem and seeing teto and osu reminded me of something

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

The Intellegent round made me feel intelligent, reached Pupil for the first time

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

I caught the user ICPCCode cheating in the past contest

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

oh yes!

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

my sub got WA on test 2 help me plz

344941167

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

Did literally no one see the hollow knight reference: "No cost too great", "No mind to think", well maybe if it was not TOTALLY HK but still.

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

C1 I cant find what's wrong with my code.I have a same way with answer but i always get wronganswer in 144 of test 2.can anybody tell my how to get a whole test content or

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

how the hell is maspy not at the first!!!

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

Problem E seems to be just a slightly tweaked version of https://www.codechef.com/START203A/problems/SETMED. Even the main idea of the solution is same. I am surprised no one pointed this out given the codechef contest is just a month old.

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

Handles: vedanshtomar48 and rishipaltomar612 Submissions: 344727962 and 344726280 for problem 2154B

I want to clarify that both of these accounts belong to me. I mistakenly used two different accounts during the contest without realizing that it violates Codeforces rules.

I sincerely apologize for this mistake — it was not intentional cheating. I fully understand the rules now and will only use one account (vedanshtomar48) in all future contests.

Please review my case. I kindly request not to ban both accounts. I’ll delete or stop using the extra one permanently.

Thank you for your understanding.

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

A really cool question, from C2, you are also given a list of primes, I want C2 but their must be a ai, aj such that i != j, where there exists a prime in the list that divides their gcd(ai, aj), C2 is this question where all primes are in the list.

this is kinda cool try in O(nlog(n)loglog(2e5)) or even faster and let me know

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

Great questions!

really enjoyed solving these