Hi, Codeforces!
We are pleased to invite you to Teza Round 1 (Codeforces Round 1015, Div. 1 + Div. 2), which will be held on Apr/05/2025 17:35 (Moscow time)
The problems are authored and prepared by CharlieV and me. You will be given 8 problems, one of which is divided into two subtasks, and 3 hours to solve them. The round will be rated for everyone.
I would like to thank everyone who has helped prepare for this round:
- Sugar_fan for his excellent coordination.
- Alexdat2000 for the Russian translation.
- CharlieV, ExplodingKonjac, QwQwf, sinsop90 for providing problem ideas despite a few unused.
- 244mhq for reviewing some of the problems when coordinating my previous rounds.
- EvenImage, StarSilk, 244mhq, N_z__, yeminghan, Error_Yuan, dieselhuang, CutieSmileHaruka, QwQwf, Hanghang007, shstyle., gdf_yhm, 66E61d, beaten_by_ai, Yandere for testing the round and providing useful feedback.
- MikeMirzayanov for Codeforces and Polygon.
The score distribution is $$$750 - 1000 - 1500 - 1750 - 2250 - 3000 - (2500 - 1750) - 3750$$$.
Good luck, have fun!
And now, a few words from today's sponsor!
Greetings, Codeforces Talents!

We are thrilled to invite you to Teza’s first Codeforces competition!
Participants will have a chance to win Teza sticker packs and T-shirts:
- The top 25 ranked competitors.
- 25 randomly selected from places 26-100.
As a systematic quantitative hedge fund, we know that exceptional talent drives success—so seeing this community come together is truly exciting.
Good luck to all participants! And for those not competing, thank you for stopping by—if you're passionate about technical and algorithmic challenges, solving Olympiad-style problems, and diving into data-driven research, we’d love to connect.
Check out our career opportunities here and explore where your skills can take you. To join our team, please fill out the form.
Enjoy the competition and happy coding!
UPD 1: Score distribution changed.
UPD 2: Editorial is released.
UPD 3: Congratulations to the winners!
- zhoukangyang (Congratulations on solving all problems!)
- Ormlis
- ecnerwala
- Benq
- maroonrk
- LJC00118
- Kevin114514
- tourist
- 0tesmem
- jiangly








Auto comment: topic has been updated by zltzlt (previous revision, new revision, compare).
Turtle is back :)
hi sorry can I ask what does turtle refer to?
Turtle is author's favourite character, see his last contests where problems are really so interesting and the character used there is turtle.
hello! is there any penalties for wrong submissions?
Your development of rank will be as slow as a turtle.
As a tester,I've tested three Div. 1+2 rounds in two months : )
Hope you enjoy the problems in this round!
As a participant
As a tester, I want upvotes :)
Problems are interesting, and wish you all GL & HF!
As a tester, this is my first time becoming a tester. Wish u all GL & HF !!!!!
As a tester, the problems are challenging and, of course, Turtle is sooooooo orz.
Wish you all have fun with this contest!
of ya zalameh yes3ed galbak <3
I hope I get high rating and Teza sticker packs
Expecting increase
chance to win stickers u say?
Contests with Turtle are always challenging! Let's go!
yeah very excited about relocation to yerevan (no)
You should be excited about money
is this means that G1 is easier than E?
probably no but it can be easier than F
i will do the problems in this order:a-b-c-d-(g1 or e)-(e or g1)
As an EST tz participant I am excited to do my quarterly rated contest.
Hello zltzlt are there any penalty for wrong submissions?
ofc
GLHF Guys!
SpeedForces till D ?? This is what Score Distribution is implying..
I hope I reach pupil again
do you think it is rated?
It is rated.
permutation forces
next_permutation(round.begin(), round.end());
No wonder CF's recent rating increase has been so difficult.
We are actually competing with Artificial Intelligence.
I loved this contest
Can't enjoy permutation rounds :(
Has there always been a penalty for wrong submission on test 1?
There is no penalty for wrong answer on test 1, but there is a penalty for resubmission
A missing permutation Round~
Fun Contest! Apparently i'm not ready to "blossum" into a Candidate Master at this time
Seems like I'm ready though
.
How do you make D's checker?
Check if, in the output, there's a set of at least m+1 0s that are all at least k+1 away from each other, then the same for 1s, 2s, etc. The first number that the condition doesn't hold for should be the answer.
permutationforces
Tons of permutations and sequences. Are there any other topics besides just math? This contest is designed to give advantage to AI-based cheaters. Poorly done by authors and coordinators. Next time please at least try adding other topics to the contest.
How does this contest give people using AI an advantage?
I meant problems A to D, which do not involve any implementation. Less code, more simple observations. That's an ideal case for AI-based.
salty clown lol
real, just look at D so many people have similar solution 5 lines of code you cant even say they cheated or not
Yes, that's basically one of the key examples. Few months ago there was a similar case with Div2 E problem, which required just a formula. This type of problems for high points opens up so many opportunities for cheaters, not only those who use AI actually.
ya just a loop is sufficient to solve D
Less code is not ideal for AI because main advantage of AI on simple tasks is writing code instantly with almost no mistakes, so more straightforward implementation -> greater advantage for AI.
🤡 🤡 🤡
man I got 3 WA on C due to silly mistake and was D really that easy?
what is the edge case of C I cant find that case
D is easy to me, I tried to calculate f(a) (maybe the hardest part) then the rest is just printing out...
I should have tried more;/
i got 7 wa on C and wasn't able to clear it, can you please tell what did you do?
I dont know about edge cases I only got wa because I was taking mid as (n+1)/2 even though I am using 0-indexed array
i made the loop run till n for safety, but still not able to pass :(
find out which test case is falling
this is my submission https://codeforces.me/contest/2084/submission/314220160 can you please tell what is wrong? my logic is if a[i], b[i] pair exist, then there must exist j!=i such that a[j]=b[i] and b[j]=a[i] for every i and let count= number of i's such that a[i]=b[i], then count should be 0 for n even and 1 for n odd, else not possible. The rest update part i have written in the code. For updating, for every i, i am finding the index of x =b[i], in array a, and swapping it with n-i-1, its desired position. My submission link is in the message above. I tried to debug it and find out the flaw, but couldn't :( I would be thankful for the help/
maybe u should try including last check funtion that checks again if everything is reversed after all operation and also for n==odd ,(try placing (a[i]==b[i]) pair into mid and do rest of the operation like me ) check my sol
PermutationForces.
Individually the problems were nice but as a whole problemset the $$$5$$$ permutation problems were annoying.
I agree. Also, having 2 $$$\text{mex}$$$ problems in a row also got me hard. It's probably the topic I'm worst at, and this exactly killed my whole contest performance...
And there are quite a lot of construction questions.
why people hate constructive problems
They take a lot of time and are boring to implement. For example, C was very easy to solve, but due to the need of construction, it takes much time.
why does this give incorrect answer for D -> https://codeforces.me/contest/2084/submission/314116450
test
9 2 3your ans:0 1 2 0 1 2 0 1 2(mex = 3, correct)test
9 2 2your ans:0 1 0 1 0 1 2 3 2(mex = 2, but you could answer with the array above and get 3)Check this case:
10 1 2Your solution's output is0 1 0 1 2 3 2 3 4 5, $$$f(a)=4$$$,one correct answer is
0 1 2 3 4 0 1 2 3 4, $$$f(a)=5$$$.How to do D?
Binary search on mex value, for the check fxn greedily create the answer array as $$$0, 1, 2. . x$$$ repeat this till the array size is upto $$$n$$$ where $$$x$$$ is the mid value that you pass in the BS. Check if this array works by segmenting it into $$$k$$$ sized subarrays and finding the mex.
Thanks for the contest! The problems were very interesting.
Individually the questions were good, but man 5 permutations qs in 1 contest is a lot
I find E, F, and G (at least G1) nice, thanks for the round! However I want to comment one thing about statements, as a message to Sugar_fan and other Cf coordinaters :(
Why do you use the wording "permutation of length $$$n$$$"? It is too informal, and the worst case was today's E where the footnote has an important information that it is a permutation of $$$(0, 1, \ldots, n-1)$$$ instead of $$$(1, 2, \ldots, n)$$$. This should no longer be a footnote. I would really like wordings "permutation of $$$(0, 1, \ldots, n-1)$$$" and "permutation of $$$(1, 2, \ldots, n)$$$" to be used.
Discussion at https://codeforces.me/blog/entry/116986 .
I don't think atleast for E mentioning about permutation is not required because if it is 1,2,..,n, answer is always 0
The problem here is that two different definitions were used in the same contest! (A, C, and G used $$$(1, 2, ..., n)$$$.) It should be clear from the main part of the statement what the definition of "permutation" is, without having to work through the examples or read footnotes.
Currently, in Polygon's rules, it is required to use "permutation of length $$$n$$$" and footnotes to define permutations. So basically it is a rule to do so, and we are not really able to change.
Thanks for the information (I had only heard it was "default" or something). For me the "rule" just seems to spread a bad habit... I don't know who to contact, but I hope coordinators are aware of this and could take some consideration.
Indeed, the footnotes should only be used for standard definitions, which in this case is 1..n. I'll update the rules to make them clearer.
me.
I solved four problems with A, B, C and D. I think they are really interesting. But this round seems to have a higher proportion of constructional questions in the earlier part(not positive or negative but subjective).
Good round because I will become candidate master after this round(if I will not be hacked or fst).
How to get permutation sequence in C? I got the fact to check if it exists, i.e if the grid has a reversed column corresponding to each column.
You are right but don't forget to consider that if n is odd, a column won't have its reverse just like:
So before your idea, you should check it if n is odd.
If you can pass the following sample, I think you can pass this problem.
More detail about it is in my code(26-th line to 56-th line)
Right, got the odd even part.
Can you explain how you implemented the swapping sequence? The first loop is for setting the equal ones that is understood, for the rest the swaps should be {index of the current column, n — (index of the reverse column) + 1} but what is the idx variable doing there?
The general idea of this part is to scan from $$$1$$$ to $$$n$$$ in sequence. If there is a matching $$$(b_i, a_i)$$$ for the current $$$(a_i, b_i)$$$, then the position where this $$$(a_i, b_i)$$$ "should" be is fixed, and I need to move it to its correct position; otherwise, we only need to record the current position of this $$$(a_i, b_i)$$$, so that when the current $$$(b_i, a_i)$$$ appears, we can operate as mentioned above. This is the general idea of my code.
can you look at my code that cases are working actually and I cant find the corner case.my code EDIT:I found the mistake in my code
how to solve E?
If a single problem between E/F/G would have not been permutation based this would have been an amazing round. As it stands I enjoyed the problems but the theme was getting a bit repetitive :)
There are 5 questions about permutation in this round. Notice that these kinds of questions make up half of the total number of questions (T_T)
Can someone tell me how E?
No graph problem appears in this round.
What is the point of restricting FFT solutions in E? (because of time constraints)
What is the FFT solution?
You could use FFT in order to count the number of segments that have a specific amount of -1.
I appreciate the problems individually, but I'd like to urge the problemsetters (including the future ones) to diversify the problems' topics and their types. This one problemset consisted of a total of $$$5$$$ permutation problems and $$$2$$$ MEX problems in a row, and $$$4$$$ of the problems were constructive. There's nothing wrong with each problem by itself, but I'd prefer not seeing them altogether in a single contest.
Problem solving has a lot more of other topics than just these, and I'd like the contests to test if the contestants can handle a wide range of these topics, not just a very few of them. Not just this contest alone, but during the past $$$1.5$$$ years I could only feel that Codeforces' problems have been too biased to a few topics, some of them being XOR, MEX, and permutations.
On another note, I feel problem A should have limited $$$n$$$ to odd numbers. It's easy enough to construct a permutation when $$$n$$$ is odd, but it's hard to prove that there is no solution for even $$$n$$$. It's obvious that the problem wants us to just guess it because otherwise the problem can't be an A problem, so this problem basically tests our ability to guess and not to construct the answer or prove the impossibility for even $$$n$$$.
Not a good contest . As a D question , there should be something like greedy , dp , graph , etc.
also C was also an implementation part only . Plzz make the contest well balanced . (like include good topics).
In my opnion, ABCDFG were great. Maybe A required a little proof by ac, but I liked all 6 problems.
But C why? 0 ideas, heavy implementation, I have no idea why the problem exists. I just don't get it.
Though the topic of the round was biased to permutations, looking back, I was amazed there are so various approach to solve permutation problems.
Can I request for a rerun of my solution in E? My code that passed pretests got RE 10 however after resubmitting the same code it got accepted idk why
GreedyForces, CheatersForces.
orz zhoukangyang, insane performance! Congrats on Rank 1!
PermutationButWeReplacedSomeWith0Forces
Huge unbalanced round. Problem E — G has estimated difficulty at least 2300 and A-D is at most 1500 (from clist.by). I get stuck at problem C, which completely ruined my contest.
It's very hard and i felt in E
Congratuation GOAT orzdevinwang.
Congratulations to the winners of the Teza sticker packs and T-shirts! You will be contacted via private message soon with instructions on how to claim your prize.