Greetings, Codeforces!
We, CodeClub IIT Kharagpur bring to you second edition of CodeNite 2025. a competitive programming contest with individual participation to be
held on Codeforces, sponsored by Intercollegiate Informatic and Competitive Programming Camp private limited(IICPC India). This contest is OPEN TO ALL, irrespective of college, year of study, or department. The top performers may get referred to top quants partnered with IICPC India. The problemset is aimed to have difficulty of a Codeforces Div. 2 round.
Details are as follows:
- Date: Sunday, 26th October 2025
- Time: 14:00 to 16:00 IST (GMT +5:30)
- Platform: Codeforces
Prizes:
- 1st — 4000 INR
- 2nd — 2500 INR
- 3rd — 1500 INR
- 4th — 1000 INR
- 5th — 1000 INR
Testers: Um_nik, picramide, harshith_04, morphinecode, psp_09, pastimeplays, Mehul_05, Praty_sp, its_magic
Contest Link: Link
Register here if you want to take part and be eligible for the prizes: Google form link
Deadline to register: 2 PM IST, 26th October 2025.
NOTE — Though everyone is encouraged to participate, only Indian college students are eligible for prizes.
See you all on the leaderboard!
A word from our sponsor:
IICPC hosts two flagship annual recruiting events — Quantfest and Codefest — both of which have gained immense reach across India.
The upcoming IICPC Codefest 2026, scheduled for January till April 2026, will be conducted offline. Institutions interested in participating are requested to contact us via their institute faculty or club head at codefest-inquiries@iicpc.com.
For context, over 40 students were recruited by leading quant and software firms through Codefest 2025.
UPD1: The contest duration has been updated to $$$2$$$ hrs.
UPD2: Contest registration has begun. You can click on the contest link and register.
UPD3: Editorial
Thank you so much for participating!
Congratulations to the winners(with tie at posititons $$$2$$$ and $$$5$$$, how did you guys manage this xd):








Hoping for a positive reception from the community for the contest, and that you all enjoy the problems.
a nightmare, part-2
(well this was just a meme, i hope that you write good unpredictable problems this time, and i hope that this time cheaters would'nt ruin the image of iit kgp codenite)
Clash with Indian ICPC Camp
All $$$8$$$ ICPC Camp contests are over as far as I know.
Please don't repeat what happened with the last contest organized by IIT-KGP!!
What happened
the craziest CF lore of '25
afaik they had to cancel div1 just before the day of the contest due to some reason. not too sure though
They had to cancel the Div1 because one of the questions for div1 was copied from somewhere else and they didn't notice it when problemsetting.
what a shame. but kudos to them
Super excited for CodeNite 2025! Huge shoutout to CodeClub IIT Kharagpur and IICPC India for organizing such an incredible opportunity for the programming community.
Super Excited and Looking Forward for the contest !!
IICPC supporting anything would be great only :) , Huge fan of their work particularly Codefest and Quantfest. Keep it up guys.
True
Wtf only 5 testers? EDIT: more were added later
Hi, this is an unrated codeforces gym contest where we as authors are not receiving any compensation for the problems that have been set. There are significant differences that these have in comparison to rated rounds or championships. People don't tend to agree to test these contests as they don't find it worth their time and effort, which is fine thinking as unrated contests are not of the same significance and don't reach the same level of audience as a rated round. The above contest isn't even accessible if not through the link that has been put up in the blog.
Also, its the quality of testers that matters more than the numbers. An experiened tester's feedback is quite more extensive and helpful than one who has tested the round for the first time. We do have more testers who will be testing out and whose names we'll be putting up as and when they finish testing.
Apparently 3 Specialist = 2 Person
When he commented, there were $$$5$$$ testers. I've added one more and will add some more when they've finished testing.
Omg Um_nik is testing in this contest !!
Will the format be similar to Div 2 as well?
The scoring will be ICPC style, i.e. similar to edu rounds.
Is this a rated contest?
No, the contest is unrated.
ok
The contest will be starting soon. All the best to all the participants!
All the best to everyone participating! Good luck to all ^_^
is the questions in sorted order?
Yes, we did try that.
When will we able to see other participants code after the contest or will the code won't be made visible (as, this contest was only accessible through the link)?
The codes won't be made visible.
Can someone give some hint for problem c ? (Only hint)
subsequence
for ith index think of subsequence from that index instead of subarray (property of xor).
dp
Think of $$$O(n^2)$$$ solution.
Use DP.
Think of knapsack approach.
If at $$$index-i$$$, then you can use arr[i] ^ S, where "S" is any XOR formed using XOR of elements from range arr[i+1] till arr[n].
liked the questions, good contest. was E about eulerian tour and then efficient searching using seg tree?
We'll post editorial soon, but we didn't use seg tree to solve it.
You can maintain the paths from top to bottom using DSU (kind of disjoint paths where you go from a node to minimum of its children). Every query just takes one path (the component of node b) removes the leaf and merges it with another path if required.
does the technique used in E have some common name ? , and it would be helpful if someone recommend similar problem to E, for practice. Thanks.
It's called path compression. You can read more about it at https://cp-algorithms.com/data_structures/disjoint_set_union.html#path-compression-optimization .
The general idea is to store mappings from a node to some leaf node. And, when a leaf node is removed, we want all the mappings that pointed to this leaf node to point to some other leaf node. In a sense we want a chain/path of redirections, but finding where a node leads to should not be done in $$$O(n)$$$. Path compression will reduce that time complexity to amortized $$$O(1)$$$.
You can also think of why you need a DSU like this: all the remaining nodes are divided into disjoint subsets such that each node in a subset leads to the same leaf node. Now, when a leaf node corresponding to a subset gets removed, we want this subset to end at some other leaf node. That (some other) leaf node will have its own corresponding subset that lead to it. So, we are merging both the subsets.
Another common issue with non-trivial DSU problems is where to store information corresponding to a particular set? For example, we want to store the destination leaf node for each set. Each set has a leader node that identifies it (might change on the
uniteoperation). We can maintain a vector of lengthnasinfo, and store that set specific information atinfo[leader].thanks , your explanation helped a lot.
In this approach rank/size compression wont be possible since we need the successor node of a leaf that is removed to be the parent of the sets . Am i right here?
There is an ambiguity in my response. The chain of redirections/reassignments we are compressing is different from the path in the DSU. We can use any implementation of DSU, with or without path compression, to implement it. All we need is to track which leaf node corresponds to a set of nodes, efficiently.
One possible sub-problem that can be derived from this problem is: given an array $$$a$$$ of length $$$n$$$, $$$1 \le a_i \le n$$$. You have to process queries of two types. $$$1~i$$$: Answer with the value of $$$a[i]$$$, $$$2~u~v$$$ Assign all the elements with value $$$u$$$ to $$$v$$$, i.e. for all $$$i$$$, set $$$a[i] = v$$$ if $$$a[i] = u$$$. You can try to think of a solution for this problem.
I have annotated my solution. My implementation is slightly different from the editorial. https://privatebin.net/?b3bc9edeee694c39#B7YoZ5Eow6yuAnWe26syW1V8fNascSbVVBb8WQTVN4uA
Here is another easy solution: Get the dfs order of the rooted tree where children of each node are sorted by $$$a_i$$$. For any node, the answer would be the nearest leaf to it in this order. So we maintain a set of leaf nodes ordered by tin time. For any query find the lowerbound in this set. When removing this node, check if the parent is now a leaf, if yes just insert in the set.
can any body explain third problem
i thinked like first move from right and try to make a[i] as large as possible with a[i]<=a[i+1] but then i realised that order will matters ? we can not do operation from last
Here is the editorial. Hope you guys enjoyed the contest!
why i am not able to see other code ?
I hope that the prize money doesnt get split among the tie breakers :)
Good contest.
Which rank are you then?
5th rank. Ashwanth.K and KingMessi tie
Then it has to split, right?
I am not sure of the contest rules, but if the money is decided to be splitted, then Rank 2 would get lesser cash prize than Rank 3. (there was a tie in Rank 2).
1, (2+3)/2, (2+3)/2, 4, 5/2, 5/2
Then Rank 2 guys get Rs 1250, but Rank 3 guy gets Rs 1500, which doesnt make sense to me
Re-read my comment 4000 2000 2000 1000 500 500
sorry misread your prev comment, i misintepretted it as
1 (2/2) (2/2) 3 4 (5/2) (5/2)got it, thanks.
I was wondering if organizers could extend the prize pool to give 4k, 2.5 k, 2.5k, 1.5k, 1k, 1k, 1k
This is most likely what we'll be following.
Why am I not able to see the failing test case, now that the contest has ended?
Have fixed, you should now be able to see failed test case for the code that you've submitted.
Nice contest. Thanks for the problems.
Dragmon Can you make other people's code visible?
im your son