Hello to all fans of competitive programming and Codeforces enjoyers! We're happy to invite you to participate in Hello 2025, which will take place on Jan/04/2025 17:35 (Moscow time).
We, I_love_kirill22, dope, and induk_v_tsiane, have prepared 8 problems for you, and you’ll have 2 hours and 30 minutes to solve them. One of the problems is divided into 2 subtasks. The round will be rated for all participants.
Huge thanks to MikeMirzayanov, geranazavr555, and KAN for great systems Polygon and Codeforces!
Special thanks also go to:
- FairyWinx for coordinating this round, finding testers, and providing moral and technical support.
- turmax, LeoPro, Kapt, sevlll777, Pechalka, Adam_GS, evjeny_23, Iura_Shch, Noobish_Monk, Chalishkan, BottleOfJuice, v0s7er, Error_Yuan, zwezdinv, RP-1, mz1, RomkaRS, epcgmein, golikovnik, and KiruxaLight for testing.
- Anna Zaitseva for the moral support of all our projects.
Score distribution: 500 — 1000 — 1500 — 2250 — (1000+2000) — 3500 — 3750 — 4500
UPD (Update!) (Update! Yey!) Editorial — link
This round was prepared with the support of T-Generation. If you are a Russian-speaking student, please switch to the Russian version of this blog. There you will find information about our educational projects that may be interesting for you.
UPDATE
Congratulations to the winners:
dope you are such a skibidi sigma rizzler
I_love_I_love_kirill22
i_love_dope
as a participant, I will participate.
no cap?
……
LFG!!!
Hello 2025
speedforces?
1h screencast incoming then :) ??
ig 30 minutes would be enough
Simplest E1 ever?
1000 E1 seems a bit fishy. I think solving in order A->B->C->E1 can still be better than A->B->E1->C.
E1 turned out sussy after all.
wth is your pfp
I think score distribution is not about rating actually...
-- a lgm
you mean a specialist
bruh
It's not about rating, but it does tell you the relative difficulty of problems in the contest. In this one, we can see that both B and E1 are worth 1000 points, so they should have about the same difficulty (although E1 will probably be a bit harder, because the easy version of a problem with multiple subtasks usually gives a bit less points than it would if it wasn't a subtask). Usually, E1 is way harder than B, so this is rather atypical.
Hope everyone starts with positive delta this year. All the best FOLKS <3 edit- don't downvote please. Get me some contribution yo.
I WILL RETZRN SPECIALIST
hope to get 1800 :)
I wish everyone could reach their destination by this contest. Best of luck!
E1 only 1000 points???
E1 = B < C ???
I'm surprised.
I also love Kirill ;)
I_love_kirill22 is the language of communication and lecture in the camp Russian or English?
Russian, that's why we wrote information about the camp only in the Russian version of the blog.
А кружок доступен для уже не школьников? Is camp available for no longer school students?
Hope chenlinxuan0226 can say hello to Expert rating after "Hello 2025".
Very much excited to participate in the first contest of this year!!
I am not excited at all about this first contest or about anything else.
It turns out to be just a bad mood. Now, I am super excited. I shall never be green again.
dope has a small eggplant
How do you know? You tried it? :))
This is the first contest of the year. Happy new year everyone!!
E1 is just 1000 Damn
Will there be problems for div4 programmers?
A and B look suitable
Thank you for answering
You can check Atcode Beginner Contests, at Atcoder website, very fit for div 4/3/2.
There are a contest each Saturday, including today.
will it be suitable for me (my first time to participate in a contest)?
worth a try, you'll know how contests work
You will never know if you haven't tried. Try participate in some contests.
I am not sure but I guess a virtual participation in a div 4 contest is a better choice. Also, you can join Atcoder ABC contest which will start soon today.
let's destroy this contest
Awake! u r just a newbie not an LGM :(
i know before you tell me i am stuck at this rating newbie but its not a fault to change my rating to this
Of course it's not. I am just kidding.
oh ok hope you do well in this contest then
quick question, what division is it going to be in?
+1
Rated for all participants similar to Div.1+2
It's equally rated for all. We r the same, we should NOT be divided into divisions because there are no individual differences between humans.
How many problems will be given? I'm at the beginner level, so are there any beginner-level questions?
does this mean that the authors predict that $$$E2$$$ will be easier than $$$D$$$?
maybe
The difficulty of the hard version of a problem is relative to the sum of their scores, not just the hard version's, so E2 will be harder
D will be more difficult to me than Ds in other div1+2s
I hope this first contest of 2025 will be fun
Fun will not make you strong, hardship and struggle will.
Thanks for your kind advice!!
Hopefully the problems are as good as Good Bye 2024! A little concerned that the writers were decided so late...
I hope I could Solve at least two questions ......
U r a gm. So it's very ez for u to solve 2.
Is it a good idea to drink coffee before a contest? If yes, how long before contest should I drink it?
Why are there so many unmatched nametags(rating <-> color)? What happened with them
hope i get to expert on this round for a lucky year!
wtf is this pfp!
hopefully i don't mess this one up!
update: i messed it up.
Nooo :(
Better luck next time...
How can you conceive splitting the E in this economy?
new year, new hope. Hoping positive delta
_ hello 2025_
What a thrilling and exciting game (forced smile)
(answer $$$q$$$ queries)forces
i am gonna start skipping contest that has anything to do with bit manipulation in c or b. It turns to a game of pattern guessing though brute force.
It's not guessing .. if u have done the problem of finding bitwise and/or of a range , the problem won't be much of a pain
i have petition to permanently ban bitset problem from rated contest
I'm super confused about the number of points for E1. I thought maybe I should try solving it instead of D, but came up with no solution even after I solved D.
I felt even E2 is easier than D.
what is the hack for problem B? is it attacking unordered_map solutions?
Yep
A: When the MEX value of a set be positive, this set must contain $$$0$$$. WLOG assume $$$n<=m$$$ and $$$a_{1,1}=0$$$, then the answer will be MEX of first row plus MEX of first column. If we let $$$a_{1,j}=j-1$$$, the MEX of first row will be $$$m$$$ and MEX of first column will be $$$1$$$, the answer is $$$m+1$$$. On the other hand, value $$$1$$$ cannot be contained in both first row and first column, so the minimum value of MEX of first row and first column is $$$1$$$, therefore the answer is not greater than $$$\max(n, m)+1 = m+1$$$.
B: Let $$$T$$$ be the number of different values in array $$$a$$$, in each operation we can only reduce $$$T$$$ by at most $$$1$$$ (because all values we remove from $$$a$$$ are equal), and if we choose $$$l=1, r=n$$$ everytime, $$$T$$$ will definitely be reduced by $$$1$$$. So when $$$k=0$$$ the answer is the number of different values in array $$$a$$$. When $$$k>0$$$ we need to reduce $$$T$$$ as more as possible, so we need to find value $$$a_i$$$ with minimum number of occurence annd change their value, until we used up all $$$k$$$ operations.
C: First assume $$$a, b, c \in {0,1}$$$. We can see $$$(a⊕b)+(b⊕c)+(a⊕c)$$$ is 2 when $$$a, b ,c$$$ are not the same, and $$$0$$$ otherwise. To find the answer we look at bits of $$$l, r$$$, start from the most significant: Let $$$j$$$ be the most significant bit where $$$l,r$$$ differ, so for $$$j+1$$$-th bit and higher $$$(a⊕b)+(b⊕c)+(a⊕c)$$$ can only be zero. Let $$$B$$$ be the $$$j+1$$$-th bit and higher part of $$$l$$$ and $$$r$$$, and $$$p=1\lt\lt j$$$, we have $$$l < (B|p) <= r$$$, and because $$$r-l>=2$$$, either $$$B|(p-2)$$$ or $$$B|(p+1)$$$ should be in interval $$$[l, r]$$$. By calculation we can see when $$$a=B|(p-2), b=B|(p-1), c=B|p$$$ or $$$a=B|(p-1), b=B|p, c=B|(p+1)$$$, the value of $$$(a⊕b)+(b⊕c)+(a⊕c)$$$ will be the maximum possible (which is $$$1\lt\lt(j+2)-2$$$).
D: We solve the problem by segment tree: For each node representing range $$$[u, v]$$$ we store these values:
When we need to merge 2 ranges $$$L$$$ and $$$R$$$, we first assume we pick max and min value of $$$a_i$$$ both in range $$$L$$$. In this case we don't need to extend the range outside of $$$L$$$, because we cannot get any better answer, so this case answer is $$$L.ans$$$. Similarly when we pick max and min value from $$$R$$$, the best answer is $$$R.ans$$$. If we pick max value from $$$L$$$ and min value from $$$R$$$, we need to find $$$\mathop{\max}\limits_{i \in L, j \in R}a_i-a_j-(j-i)$$$, which is equivalent to $$$\mathop{\max}\limits_{i \in L}(a_i+i) - \mathop{\min}\limits_{j \in R}(a_j+j)$$$, so the best answer for this case is $$$L.max_{-}plus - R.min_{-}plus$$$. Similarly, for the last case, the best answer is $$$-L.min_{-}minus + R.max_{-}minus$$$.
E2: For a certain query $$$(a, b, k)$$$, let's find how to check whether $$$w_k >= t$$$ for certain $$$t$$$. Let's assume all edges in the graph with $$$w>=t$$$ has cost $$$1$$$, and other has cost $$$0$$$. If we can go along any path, move from node $$$a$$$ to $$$b$$$ with cost $$$\lt k$$$, then $$$w_k$$$ will be less than $$$t$$$ in this path. Otherwise, for every paths from $$$a$$$ to $$$b$$$ we need to pass at least $$$t$$$ edges with $$$w>=t$$$, so we have $$$w_k>=t$$$ for every paths. Therefore to solve this problem, we can sort all edges by $$$w$$$ from lowest to highest, change their cost from $$$1$$$ to $$$0$$$ one by one, and for any query $$$(a, b, k)$$$, if cost from $$$a$$$ to $$$b$$$ dropped down to $$$k-1$$$ or less, we know the answer for this query is $$$w$$$. So the rest we need to do is keep updating value of $$$cost(a, b)$$$ when cost of edges changed. The initial cost can calculated by Floyd's algorithm in $$$O(n^3)$$$, and $$$cost(a,b)$$$ can decrease at most $$$n-1$$$ times, because if nodes $$$a, b$$$ is connected with edges of weight $$$0$$$, adding an edge with cost $$$0$$$ on $$$(a, b)$$$ will not cause any change of cost on this graph. Each time such decreasement occurs we can recalculate $$$cost(u, v)$$$ for all pairs in $$$O(n^2)$$$. So the problem can be solved in $$$O(n^3+ m\log(m) +q\log(q))$$$.
G: If you've planted sugar cane in Minecraft, the answer is easy to come up with: First, we find all positions $$$(i, j)$$$ where $$$-1<=i<=n$$$, $$$-1<=j<=m$$$ and $$$(i+3j) mod 5 = 0$$$, and try to add these positions into $$$S$$$: If position $$$(i,j) \in A$$$, we add it into $$$S$$$ directly, any otherwise for each adjacent position $$$(i', j')$$$, we add it into $$$S$$$ if $$$(i', j') \in A$$$. Therefore we've built a set $$$S$$$ satisfies the second condition. To match the first condition, we repeat this process for $$$r \in [0,4]$$$ and $$$(i+3j) mod 5 = r$$$, and pick the set with minimum size, this set will satisfy the size condition. (Prove by AC)
i hate problems like C
A: I don't know why this works
B: I don't know why this doesn't work (later edit: forgot to pop from priority_queue :(, somehow first pretest passes with this bug X( )
RIP one and a half hour for D LOL. Come back CM anyways.
How to solve C ?
Hi
Very heavily math based contest this time...
I joined an hour late (oops), solved A, B and C. I particularly enjoyed C, but that's just me due to my heavy math background.
This contest might be a bit unpopular with the crowd though... knowing how Goodbye 2023 went...
B: I am sure we were presented a totally different problem... I cannot understand why this happens with this many testers (and why so many contestants "solved" it without trouble), please write a correct statement. The Codeforces rule is also bad and this issue affects too much to the performance.
G (and in general): Why ML 256MB?
H: Chip-firing is well-known. Anyway I needed some observation, so perhaps it is okay.
B. Sorry :(
G. There is no special reason. 256MiB is just a default Memory Limit in Polygon
H. Wow! I honestly didn't know about that. But still, for me, the solution to Problem H looks like an ordinary adhok, and as if no deep theory helps much.
I'd say default ML in Polygon is bad... (Please take this as a message to coordinators and future authors! The problem G itself was nice!)
H: Actually I'm not sure if deep theory helps, I just meant this is a known topic so there are similar problems about chip-firing on path, like GCJ 2020 Round 3 C or <Cf problem which I don't remember well>, so I guess some people knew the high-level idea.
G is much easier than C. Even 5-year-olds have solved it while building sugar cane farms in minecraft.
Bro, you not only solved the problem, but also understood how it appeared! Bravo :)
Also when you are using Sprinkler in Stardew Valley.
On the other hand, I found G to be the hardest problem of the round. T.T
For me, the only nontrivial part was trying to pass the memory limit.
i thought C's solution was really cool, im surprised people hate it so much
Can you please explain my thought was at every ith bit 2 nos should have the same bit and third one should have the different bit. So this I was thinking of geting l , l+1 , l+2 r r-1 and r-2 and all possible final values and get hte max out of it.
since we want at most 2 out of 3 people sharing an ith bit, we can guarantee this by having person A be 2^n, and person B be (person A — 1)
for example person A = 16, then person B = 15
16: 10000
15: 01111
this leaves person C to take anything as long as it fits the constraints because no ith bit can ever exceed appearing twice. this allows the answer to be 16, 15, 14; and if L == 15 then the answer is 16, 15, 17 instead
u can't always chose a power of 2, depends on the interval
yeah my bad, i should have clarified the largest power of two where the most significant bit differs. so for l=139 and r=141 the msb that mismatches is the third bit (2^2)
i'm not sure if that works, u have to check if u can put to one of them full 0's after some bit, u could get a number smaller than the left limit of the interval.
AB are nice problems.
I don't like bit manipulation constructives so C was kinda hard for me. And also it looks to be above average div2C in terms of complexity.
D is an interesting problem. I would love to have more time to think on D as I even didn't manage to get an idea. Too bad C took all my time.
Ehh well. I guess I need to solve some more bit constructives.
My performance was about 1400-1600 in the old contest but recently I always get negative delta do you have any suggestions about solving div2C
C usually requires good level of observation
Sometimes I notice the main observation but I cant implement it.My implementation is bad
I struggle with Ds so I just upsolve Ds from past div2 rounds if they're in my skill range, so I check the problem rating at clist dot by. If I have no ideas for an hour or something I study editorial hints, then if I'm still stuck I check the model solution but without implementation. Then if it's not enough I study jiangly submission for that problem, as my organization name suggests. His submissions are very clean and usually there is a lot to learn from them, so I often check them out even if I managed to solve a problem on my own. I offer the same strat for div2C.
Also, what old contests with 1400-1600 perf are you talking about? I see only one Edu round with perf in that range.
Moreover, performance usually has some variance so it's normal if you get negative delta sometimes.
I mean my perf is decreasing nowadays
I failed to implement D with segment tree in time.... I just spent too much time doing it the wrong way.
I got 7 CE in F with C++20 and C++23. Didn't manage to fix it during the contest. WTF is that? :) Works on my computer just fine. After the contest, I decided to switch to C++17 in the custom invocation tab and it compiles normally. Is everything ok with the compiler?
This bug presents in gcc $$$[13, 14.2.0]$$$ which just happens to correspond to
C++20
andC++23
on codeforces. Your code also yields compile errors on godboltIt compiles locally because you probably had
gcc 12
orgcc 14.2.1
. Here are the workarounds that you can use:Also sse4.2 is older and not as good as avx2
Wow... How did this never happened to me before with C++20... Insane. Thanks!
https://codeforces.me/blog/entry/118261 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109753
can someone hack my solution for C? I just brute force things for a while and actually correctly guessed it. Sub: 299665561
I don't have any proof, my approach is finding the best fit for l ^ r, the third one is anything (I tried through brute force for this observation).
Let's say bl = bit of l, br = bit of r (At bit i). If bl == br:
The purpose is finding max l ^ r so the goal is 0 ^ 1 == 1 for every bit possible.
i hate the c++ vscode debugger and i hate my life
What a contest man, Please never make such type of contest!!
Nope.
[deleted]
Russians are setting mathforces and the chinese are now creating good rounds. How the tables have turned.
Bro, C is easier task.
of course only if you know """well known""" trick
not really, I solved C by brute force everything and guessed the solution somehow... maybe luck
You just calculated impact every bit and all
can u tell why is this wrong? https://codeforces.me/contest/2057/submission/299659764
which trick sir?
E1 and E2 are free standard problems, but unfortunately, I am intellectually disabled.
Bro how to do E1 (and E2). I got litrally no idea.
Happy new year!
I especially love problems C and G in some ways. However, people solving ABCDE1E2 have varying performance score from 2000 to 2800, which, looks very scary. I'd say my overall feedback after participating Hello 2025 is: Goodbye 2025.
Problem D is anti python users , 2 Seconds is not fair
It is not guaranteed that tasks D and more difficult can be passed in python.
Here is some feedback on the problems:
Overall I enjoyed participating. I would have had a bit more fun if the statements were a bit more carefully written, but that's fine. Thank you to all those involved in the organization.
Hi, can you please check my comment regarding D? I am getting wrong answer on pretest 2. have I made some mistake in my logic or while implementing?
https://codeforces.me/blog/entry/138058?#comment-1235038
Bro how is your immediate solution for E1. I spent 2 hours and no good idea at all.
For D, I understood that we have to build a Segment Tree for a + i and a — i, but how to find the answer after every query?
Just query the whole array
If there are some well-known techniques in C
Unless you consider "going bit by bit" to be a "well-known technique" you don't know (I think that's what you were implying by the italics), then no, there aren't.
The tasks were ok overall. E should not appear on codeforces, and D is on the edge of being fine. On the other hand, C was nice, and G too (exactly the type of task I will not solve).
E1 absolutely should not appear on CF (and I don't know what it was doing in the original round either), E2 is arguably fine but I dont like it either. Fairly standard, almost ABC-like (infact i remember a similiar trick in a ABC contest)
The preparation seemed somewhat rushed, especially with the major error on B.
I think that tasks E1 and E2 are better suited for Educational rounds.They are pretty standard
Why E shouldn't appear on CF?
E1 is extremely straightforward and standard. It is an implementation exercise, and you can see that from the given points of 1000. I dont think tasks should award any amount of points, be it even 1000, just for being able to implement stupid bruteforces.
E2 did not have any new ideas to me, and was just a test of "do you know how to maintain All Pair Shortest Distances" after adding an edge in O(n^2), which is why I also solved it within 8-9mins of finishing D.
Overall, the task is way too standard, and I can see it being ok for div2/3, but it is definitely not ok for div1.
Why does my E1 have TLE? I need an explanation
As a Python user, I know it is my fault but I HATE hacks against hash-based data structures :(
Awwww my B got FST because of TLE what the hell??? Is the Counter lib from python collections vulnerable to hacks?
from a slight plus to deep hell of minus, hello 2025.
just -12
It seems that
map
passes test in B, whereasunordered_map
results in TLE — I don't think this should be the case...i thought unordered_map would run faster so i changed it right before submitting.. very disappointed
Time complexity of unordered_map is $$$O(n)$$$ only on the average test case, there are some cases where it's as large as $$$O(n^2)$$$. The default hash function for unordered_map isn't very smart, so someone probably managed to find a testcase which runs in $$$O(n^2)$$$ on default unordered_map, hacked someone with it, and got it into system testing.
I used dict in Python and also got FST, is that the same?
Yes, Python dict is also hash-based.
Yes comrade, they're the same base.
Blowing up unordered_map, and how to stop getting hacked on it
Unordered_map hacks are quite common :(
Here is a blog post by neal that explains it.
it feels so great to be hacked on b)))
hello, 2025
the hack exist is a thing, I only hope they put some in pretest so the cost of penalty wasn't this devastating...
This is again much of a pain to bear in the start of 2025.
This not authors hacks.
Thanks for the contest! I like pC very much.
But about problem E, I think it's quite bad to define path to allow going through same vertex multiple times, since it contradict the conventional definition of path, and it's better to call it a "walk" instead of "path".
I think the problem is the same either way since no optimal path goes through a vertex twice.
Which only makes the choice to include paths with repeating vertices/edges even more confusing.
In this problem, yes. But there may be problems that would make a difference. And I hope this won't happen when we facing them.
Yea I agree with that
All solutions for B using unordered_map are getting TLEs. Isn't it supposed to run faster than ordinary map or am I missing something here?
Worst case TC of unordered_map is O(n^2)
Why is Python collection Counter prune to hashing hacks but not ordinary map regarding problem b ? UPD: never mind
pls do something about problem c. though i used map and my solution got accepted but it is kinda sad for people who used unordered_map instead of map. c was a comparatively harder today making most of them solving only problem A and getting tle at B
My screencast in rust
The use of an unordered map in the second question is making me sad
299698148 Can someone explain me why my B got TLE
Using unordered_map
isn't unordered_map faster then normal map? if not can you please tell me when i should not use unordered map.
https://www.geeksforgeeks.org/how-to-use-unordered_map-efficiently-in-c/
It looks like they included a test case against the default unordered_map hash. For more information I would suggest this blog post by Neal Wu.
I had some seroius troubles with the TLs in this round. Sure, it is about kotlin, but I feel like it could have been a little bit more lenient.
D: The direct $$$O(6C3 q log n)$$$ solution with max-matrix should have passed. I don't think it should be cut.
E: I end up taking the clean $$$O(n^3)$$$ route. I am scared of $$$O(n)$$$ many 01-BFS on $$$O(n^2)$$$ edges, but perhaps I worried too much.
F: My solution that performs O(\log MAX n) ordered set operations are not fast enough, since in many cases I need to perform 3 or 4 searches for every "normal" operation. Though, I did not completely anticipate it being not fast enough, and would have opted for a segment tree/sorting+BS/BIT apporaches instead.
G: The overhead from declaring n different arrays was too much to handle, and I ended up needing to swap n, m when n is large. Allowing extra memory for this case would have been nice. I also see no reason to make the TL this tight -- it is not like there is any significantly easier solutions if an extra log or two are allowed.
Even though it is part of my issues for using Koltin and accepted the TL issues associated with it, I feel like in quite a few cases it was needlessly harsh.
What a nice start for 2025 (-_-)
Are $$$O(n \cdot q)$$$ solutions expected to pass on E2?
I think the problem would have been better by only allowing $$$O(n^3)$$$ or $$$O(n^3 log n)$$$ solutions to pass, as it requires to do a workaround on the $$$O(n \cdot q)$$$ idea.
If by O(qn) you mean just “For every distinct state, check and answer every queries”(this is how I used it), then this can definitely pass, as the access patterns are very predictable (looping over all q queries). I worried less about this part than the actual $$$n^3$$$. I think a $$$n^3 log n$$$ is practically a lot worse than this $$$O(nq)$$$.
Yes, that's what I mean. Yeah I didn't even check how many operations was the $$$n^3logn$$$ (even without considering cache it's 3 times slower). My question was because I couldn't believe such a brute solution would pass.
Although I still think the authors should have changed the limit on $$$q$$$ to either make $$$O(n \cdot q)$$$ pass comfortably, or make it TLE in order to force the intended solution (or the one with log).
hey codeforces pls tell me what is wrong with problem b i solved it in an efficient way but not the most efficient i did this way to make the implementation more easy for me i need just to say to me in the contest that the that my code has time limit exceeded on test 12 then i will make it more efficient i try to improve my self and my rating and suddenly i decrease in rating i need just someone to tell me what should i do i am bored from you codeforces i need to become an expert just tell me how with your stupid site
the issue is that you used unordered map. change it to a normal map and it will probably be accepted
Am I blind? I cannot find any information about upper bounds on $$$k$$$ in the problem statement for E1.
In the Input format: "Each of the following $$$q$$$ lines of each set of test case contains three integers $$$a$$$, $$$b$$$ and $$$k$$$ $$$(1≤a,b≤n, k≥1)$$$ — the next question. It is guaranteed that any path from vertex a to vertex b contains at least k edges" this is enough for upper bound
But the author's definition of the path allows edge repetitions, what means that the path may be infinitely long.
there is no contradiction in this, in any case, if we take any path of minimum length, this will be the upper bound
Got it, thanks
Why was E1 worth just 1000 points?
I love this contest because D and E are nice OI style problem