yse's blog

By yse, 16 months ago, In English

أهلاً, Codeforces!

cry, Intellegent, and I are really excited to invite you to participate in Codeforces Round 1029 (Div. 3), which will take place on Jun/08/2025 17:35 (Moscow time). You will be given $$$2$$$ hours and $$$15$$$ minutes to solve $$$8$$$ problems.

The round will be hosted by rules of educational rounds (extended ICPC). Thus, all solutions will be judged on preliminary tests during the round, and after the round, there will be a 12-hour phase of open hacks. After the open hack phase, all accepted solutions will be rejudged on successful hacks. Also, note that there is no score distribution but the usual penalty of 10 minutes for each wrong submission, following the rules of educational rounds.

Note that the penalty for each wrong submission in this round is 10 minutes. Also, note the rule restricting AI use. If you are caught using AI in an unorthodox manner, you will be sent to cry's basement. You don't want that to happen.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a rating of 1900 or higher at any moment in time.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you (unless you register unrated).

I would like to thank the following people for making this round possible:

Good luck, and most importantly, have fun!

Edit: Tutorial

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

| Write comment?
»
16 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

As a tester, the problems are good. I recommend participating.

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

wowee

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

As a tester, -firefly- tested.

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

As a tester, yse held me at gunpoint to test this round.

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

As a tester, I contributed an initial AC solution that was later hacked.

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

as a participant, I hope it's all sunshine and rainbow down cry's basement :D

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

    I've snuck into cry's basement before, here's a list of items I saw:

    • Farmer Nhoj, holding a pitchfork.

    • A big bucket of lactase, which he feeds to his test cases to stop them from getting cheesed.

    • A computer simulating two copies of cry's basement.

    • A stack of problem proposals — one of which reads "It's Mooin' Time IV"

    • A group of people lying on the floor with their limbs spread out, one person standing and putting their arms above their head, to create a triangle pointing to the sky.

    • A chicken jockey.

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

hi

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

Where is cry's basement?

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

if only i had gone down by 7 more rating :(

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

I hope.

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

"note the rule restricting AI use. If you are caught using AI in an unorthodox manner, you will be sent to cry's basement. You don't want that to happen."

The FBI is here to search cry's basement.

»
16 months ago, hide # |
Rev. 7  
Vote: I like it -14 Vote: I do not like it

amazing ^_^ yeah yse and yeah Borhom

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

2 problems at least this time

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

Ok but what if I want to be sent to cry's basement???????

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

As a participant, I hope to reach expert

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

The king in this world joo

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

Hope get Specialist.

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

يا هلا

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

As a tester

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

As a participant I hope the problemset is amazing , and I reach pupil ^_^

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

My turn

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

If you are caught using AI in an unorthodox manner, you will be sent to cry's basement.

Could you please elaborate on the specifics of this? Will I be sent via plane, train, or car? If it's a plane or train, will my ticket be paid for? If it's a car, will one be provided or would I have to provide one, in which case would my gas be comped?

Thank you.

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

    You'll get on a transportation called Skipped. And you don't need to provide a car, but you'll lost contributions.

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

As a first-time tester, this is the best round I have ever tested.

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

As a participant, I wish you all a "failed system test" and "hacked" free contest

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

How to apply for the post of torturer at the cry's basement

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

As a basement, you don't want to use AI then end up in cry's tester.

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

As a tester, I can confirm cry is a Honkai: Star Rail enthusiast and his basement aims to produce free Stellar Jade.

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

Why Sunday but not Saturday?

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

As a person, it would be an Intellegent move to participate in this contest.

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

Hoping that problems will not be hard

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

as a participant, I want to see cry's basement so add another way than cheating plz :/

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

First out of competition div3!!!

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

Wish everyone enjoys an exciting match:)

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

Eid Mubarak :)

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

i have a doubt why i dont see manypeople coding in java? it seems theres enough time given in questions to code in java but alot of people dont do it

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

    Java is a ~4-5 times slow than cpp , so most people prefer cpp over it in cp

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

    C++ is the most popular because it's (one of) the fastest languages, which can be particularly helpful when avoid TLE (time limit exceeded). Python is also decently popular, mainly for beginners, because it's easy to learn. Java's in the middle ground, and while a jack of all trades can be popular in some cases, generally its not used as much (though it's not unused, I do think its still decently popular, but not as much as C++ and python)

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

As a tester, I have a proof that upvoting this comment will lead to positive delta. But the proof is too long to fit the margin.

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

as a tester, i tested late so i will miss out on all the contribution :C

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

این دنیا دیگه به درد نمیخوره

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

cry and Intellegent have never disappointed us.

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

Are we are not going to get the problem rating breakdown as in div 2

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

Be careful in this case, the output may be yse.

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

Eid Mubaraak !

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

excited for the only thing that makes me happy, good luck to all

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

good luck

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

I hope you achieve the best results and wish success to everyone.

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

gl hf

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

my current rating is 1599. finger crossed :3

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

Make sure you done end up in his basement

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

Nice contest. Had fun solving them. Thanks !

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

m2.codeforces.com down for anyone else? for me only question heading were visible but on clicking them the statements were empty.

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

    PS: It was a refreshing contest, as the problems weren't overly ad hoc, unlike the recent trend. I couldn’t figure out the relation for F, but G was easy, standard i will say.

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

C made me cry a lot.

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

I took way longer than necessary on D. Spending the rest of the time on E and probably overcomplicated it as well. Solid problems I suppose though.

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

how do you solve E?

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

    for each index i for array a check if some a[i] exists in odd position relative to i in a OR some a[i] exists at even position relative to i in b,also we need to check for indices greater than.Same for array b.if its true for any array ans is atleast i+1.We can implement it using multiset

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

What is the idea on problem D? I'm sure its something easy, I just can't solve it (even though I've solved E and F...)

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

    System of equations in 2 variables. So solve it for a[0] and a[1], (ensuring the sol is non-negative integers), then test that sol on all the rest.

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

    Assume there are x first operations and y second operations, then you get two equations:

    a[i] — a[i-1] = x — y (1) a[0] — x — ny = 0 — (2).

    Solve these two equations and check x >= 0 and y >= 0, also check x — y = a[i] — a[i-1] is same for all i.

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

    I first tried to imagine it as a linear equation. And instead of trying to reach 0 from z, I tried to reach z from x and y. Let

    • x = [1, 2, ..., n]
    • y = [n, n-1, ..., 1]

    We want: a * x[i] + b * y[i] = z[i] To solve it, I used z[0] and z[1] to form two equations and eliminate a, which gives a unique formula for b = (2*z[0] — z[1]) / (n + 1). Once b is known, a = z[0] — b * n. Then just check if all values satisfy the equation

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

very nice contest!!!

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

How to solve C

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

The rated top 5 are all cheaters? Mike, check and delete cheaters from the score board. And, we need roll back. Codeforces don't need any cheaters.

To cheaters: is using LLMs so interesting? You can't learn any thing from an AC and a good rank. your same large camel code stile and super long AI names are strange!

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

Great Round. Esp for me , C and E.

Any hints for F?

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

    one leaf or 2 leaves

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

    the tree will be always of the form o-o-o-o..-o and then two children emerging out of last o.Else answer will be 0.In simple term there are atmost 2 leaf nodes .Finf their lca and give 1 leaf node value 1 and other 2 and vice versa then construction is trivial

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

    Tree must have not more than 2 leafs. If it has one leaf, it is just 2^n. If two leafs, compute the only point with 2 children (let it be point A), lengths of paths from this point to leafs. Path from root to A can be arbitrary, then you need to be careful to compute variants of paths from leaves to A

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

I don't understand how any author would find it an achievement to write a problem like E. It's so boring and seems to just be a time-waster problem. You could have just left it at no deletions, but you decided to make it cringe. There is also like nothing to learn from it

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

    Personally disagree, the deletions added an interesting part to it (also simplified my solution, though I feel like I'm the only one that applies to).

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

How to solve H?

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

Some ideas for problem G? I tried the following but it gets WA on test 2, don't know why yet:

Insert the edges one by one using the Kruskal/DSU algorithm for MST, but stops immediately when 1 and N gets in the same set. Then, find the mininum and maximum edge in their connected component, and output their difference.

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

D is hard to implement for me ... and I think C and E have similar ideas and difficulties (maybe E even easier?)

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

What is the solution to F, I have no observation but the tree is a binary tree if ans > 0.

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

    The tree need not be binary instead it can have atmost 2 leaves.

    After this, you can start checking for number of possibilities from the leaves and you will find a way to solve it.

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

Is H based on sqrt decomposition? Here is what I had in mind:

  • If f(i) denotes the frequency of an element at index i, we need to maximize difference on function: 2*f(i) — i.

  • We can store maximum answer for each distinct value over queries.

  • To make an update (addition/removal), we maintain blocks of size sqrt(N/logN) over each distinct value. This way when an update happens, we can update all the elements of the block of that value to recompute minimum and maximum: 2*f(i) — i. Also we can keep a lazy offset to compute the changes in answer for each of the other blocks. Once we manage to update each block, we can recompute the distinct value iteratively and update it inside the global maxima set of answers.

Is my idea sane enough?

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

Can someone explain how rankings work in rounds were there is no score distribution ? Is it solely based on problems solved independently of their difficulty ?

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

    Yes ranks are on the basis of number of problems solved

    to settle ties, they are then ranked by penalty(sum of time taken to solve each problem, with +10 for each incorrect submission)

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

Really enjoyed this contest! Thank you :)

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

Why does the author think that 100 line of if else is cool for E, or my implemention is just dumb.

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

Hello , I am actually a newbie to codeforces and was not very much aware of the system , i did registered as rated contest and even solved three problems in the contest ,but it is now showing as unrated for me , can anyone help me and is there anything which i can do to get my rating increased ?? ...

If possible , do consider helping my submission id's are

https://codeforces.me/contest/2117/submission/323499358

https://codeforces.me/contest/2117/submission/323470875

https://codeforces.me/contest/2117/submission/323448302

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

I tried to solve D, using the fact that when a[n-1] = 2*a[n], I will do operations only of type 2, and the conditions, a[n-i] = (n-i+1)*a[n] should hold for all i, so first I calculated how many operations of first type are required to get a[n-1] = 2* a[n], apply that much operations of 1st type to the entire array, and then check the condition which I told. But I am getting wrong answer on test 3, can somebody please look into my submission and tell the probable error, https://codeforces.me/contest/2117/submission/323482331

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

Omg graph! I am also a Chinese problem author, and i can't believe that one day the Codeforces div3 will be exactly the same as my idea. https://codeforces.me/contest/2117/submission/323561607

https://ac.nowcoder.com/acm/contest/103864/G This is a problem I prepared about six months ago, it was used for a programming competition for a Chinese university student called the Chuanzhi Cup.

Dramatically, I didn't attend last night's Div3 because I had to review for the final exam. And I have always participated in Div3 from the second to last problem, which was the problem G for last night. It's obvious that I lost the opportunity to get first blood on this problem.

Anyway, I am honored to have the same problem as Codeforces. :)

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

Can we solve D with Binary Search?

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

    Why do you want to use Binary Search, if you can solve it easily using Linear equations with two variables.

    And still if you want to use BS, I would like to know your approach.

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

why i ac D yesterday, but today i saw D is still in queue?

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

where is my rating, I'm starving. /cry

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

Hello,

I participated in Codeforces Round 1029 (Div. 3) with a rating of 368. I made submissions during the contest and my handle appears in the official standings, but my rating hasn't been updated while others have received theirs.

Could you please check if there was an issue with my rating update?

Thank you.

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

As a tester, Help me figure out why this CPP solution works but not the same python one. CPP: https://codeforces.me/contest/2117/submission/323463628

Python: https://codeforces.me/contest/2117/submission/323479416

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

Can someone check why my F solution is giving TLE on Testcase-3, I don't know why it is doing like this. Even some Time-complexity calc showing its O(n). Please help me.

The function is solve6() for F part.(You have to scroll a bit) 323699490

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

    You pass the adjacency list v by value in the calc() function, which creates a new copy each time you call the function. Pass it by reference and it should pass.

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

Questions were interesting and was fun to solve

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

I just tried the virtual contest today, these problem were so fun! Really regret forgetting to join the actual contest yesterday :')

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

.

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

Hi Codeforces team,

I’m very sorry for the trouble my submission 323500727 caused. I honestly didn’t know that using a small helper tool could make my code look identical to someone else’s.

The core idea of the solution was my own. Because it was already late and I was very tired, I let a tool generate some quick boilerplate code and then completed the rest myself. I never copied anyone’s contest code and never shared mine. It seems the same boilerplate appeared in other submissions, so the checker flagged us as similar.

I no longer have the local files (I cleaned my workspace after the contest), but I can explain every step of my solution if needed.

I guarantee this will never happen again. I respect Codeforces and will make sure I do not compromise the fairness and integrity of any future contest, and I am willing to accept any penalty you consider appropriate.

Thank you for understanding.

— MNTEEOKK