أهلاً, 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:
- cry for being an amazing coordinator and being even more amazing to add a problem to the set, and Intellegent for adding a wowee problem to the set.
- Dominater069 for red testing.
- Proof_by_QED, __baozii__, AksLolCoding, amoeba4, catgirl, efishel, -firefly-, Edeeva, 18o3 for orange testing.
- reirugan, Friedrich, wuhudsm, rewhile, IceWolf898 for purple testing.
- macaquedev, beaten_by_ai, SpyrosAliv, chromate00, Non-origination, expertaq, DivinePunishment for blue testing.
- Borhom, _Rawan_, ETL for cyan testing.
- hotfog12 for grey testing.
- rlin61 for unrated testing.
- Vladosiya for statement translation and testing as well.
- MikeMirzayanov for developing Codeforces and Polygon.
Good luck, and most importantly, have fun!








As a tester, the problems are good. I recommend participating.
I genuinely enjoyed the contest, questions were interesting. Thank you very much
wowee
As a tester, -firefly- tested.
As a tester, yse held me at gunpoint to test this round.
As a tester, I tested voluntarily :)
As a tester, I contributed an initial AC solution that was later hacked.
as a participant, I hope it's all sunshine and rainbow down cry's basement :D
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.
Have you seen my flying pig down there?
Incidentally, I can confirm that the group of people lying on the floor are the same people who have tested some of cry's rounds in the past (such as the one by SpyrosAliv). Unfortunately, they have since escaped cry's basement and will not be testing rounds anymore.
AI users will not be treated as well, though... (don't cheat, lest you discover the true horrors of cry's basement.)
I was one of the first to escape along with cowthecow :)
Yummy!
As a tester, CHICKEN JOCKEY MENTIONED 🍿🍿🍿🍿🍿🍿🍿🎉🎉🎉🎉🎉🎉🎉🎉🍿🎉🍿🎉🍿🎉🍿🎉🎉🎉🍿🎉🍿🎉🍿🎉🍿
cry is a girl? right?
yes
yes
akasakaR is a GPT cheater? right?
believe it or not this is an account i use for fooling around or when i'm not in the mood for giving a serious contest or i'm at a family gathering or smth(I actually bring my laptop to family gatherings). most of my contests on this acc are from before gpt era, and no, except for the last contest i gave where i submitted G using gpt (i wasn't participating in that contests in my main acc, my friend solved G and i didn't believe that he solved himself so i just gave it to gpt and submitted it), I don't have any other gpt submissions
hi
Where is cry's basement?
Very good!This will be my first time to compete in codeforces!But according to Beijing time(UTC + 8), I have to stay up late. (很好,这是我第一次在CF参加比赛,不过要熬夜,顺便作为某谷谷民暗暗的qp一句)
Although I don't understand why you have received so many negative comments (maybe it's because of the Chinese language? Or Codeforces doesn't like "qp"?), I still have to say that I am also a user of luogu /kkk
expertaq orz
if only i had gone down by 7 more rating :(
I wish we could have a
A nice round where no one will cheat, and every participant can compete at their highest level of skill.
I hope.
"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.
amazing ^_^ yeah yse and yeah Borhom
2 problems at least this time
I did it
me again 3 problems.
Ok but what if I want to be sent to cry's basement???????
As a participant, I hope to reach expert
Good luck
congratulation!
Thank you
The king in this world joo
Hope get Specialist.
Hope to become a pupil. I am literally on the edge.
stop edging
cry div3 means its a div2, staying newbie man
يا هلا
wow
As a tester
As a participant I hope the problemset is amazing , and I reach pupil ^_^
As a participant, I am going to cry's basement after this contest.
My turn
why there is a red dot
oh shoot forgot to do my contribution farming out of competition post
So funny
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.
You'll get on a transportation called
Skipped. And you don't need to provide a car, but you'll lost contributions.lol
(☆∀☆)
As a first-time tester, this is the best round I have ever tested.
As a first time tester, this is also the best and worst round I have ever tested.
Earliest announcement in a while
As a participant, I wish you all a "failed system test" and "hacked" free contest
How to apply for the post of torturer at the cry's basement
glhf guys :Đ ++ratings
As a basement, you don't want to use AI then end up in cry's tester.
As a tester, I can confirm cry is a Honkai: Star Rail enthusiast and his basement aims to produce free Stellar Jade.
Speedforces?
Why Sunday but not Saturday?
why not tommorow
As a person, it would be an Intellegent move to participate in this contest.
Hoping that problems will not be hard
as a participant, I want to see cry's basement so add another way than cheating plz :/
Another cry round! <3
cry why did u choose your name in codeforces PS:Do you play Roblox? If yes can u tell me your username? (I won't hack lol)
as a tester i am gonna to get so much + delta this time.. i promise...
First out of competition div3!!!
Wish everyone enjoys an exciting match:)
Eid Mubarak :)
Eid mobarak
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
Java is a ~4-5 times slow than cpp , so most people prefer cpp over it in cp
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)
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.
I am a counterexample
Specialist plz
as a tester, i tested late so i will miss out on all the contribution :C
این دنیا دیگه به درد نمیخوره
:*)
cry and Intellegent have never disappointed us.
Are we are not going to get the problem rating breakdown as in div 2
in div2 announcements the breakdown isnt rating, but rather the point value of the problems. in div3 rounds all problems are worth 1 point
oh ok got it
Be careful in this case, the output may be yse.
Finally a contest made by cry. Hope to do good in the contest!
Eid Mubaraak !
excited for the only thing that makes me happy, good luck to all
good luck
I hope you achieve the best results and wish success to everyone.
gl hf
Assalamu Alaikum, akhi.
my current rating is 1599. finger crossed :3
not happening bro
yeah sadlife..In E, used i>0 instead of i>=0 and life fu*ked up man
Make sure you done end up in his basement
Nice contest. Had fun solving them. Thanks !
m2.codeforces.com down for anyone else? for me only question heading were visible but on clicking them the statements were empty.
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.
C made me cry a lot.
same
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.
the time took for me to solve D is longer than the combine of A, B, C, and E. and 5 WA only on D.
how do you solve E?
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
As long as the distance is more than 1, the relative position doesn't matter since we can delete one pair
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...)
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.
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.
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
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
very nice contest!!!
How to solve C
C is based on greedy approach. You need to find the first occurrence of the segment going from left to right.
For example, In this testcase, the first segment would be {5}, then keep on adding until you find a 5. The next segment would be {8,7,5} until index 4. Next we need to find a {8,7,5} which is {8,5,7} until index 7. You'd fail to find the next segment, so the answer is 3. The code is efficiently implemented with sets imo.
You can try this way to solve for this testcase: (Visible testcase 6, answer is 3.)
Greedy, in order to add 1 to the solution you want to find all the elements in the last segment.
So create a vector of sets, and start with the first segment equal to the first element. Then, start moving on the array checking if you saw all the elements in the last segment (while adding elements to the current segment), and every time you saw all elements in the last segment (removing elements in the last set, until its size is 0), you add 1 to the solution and change the last set to the new set, then repeat.
Idea : The first segment contains only the first element. After that, you continue building segments greedily, breaking a segment whenever it includes all the elements from the previous segment.
Code : https://mirror.codeforces.com/contest/2117/submission/323459167
let take direction from n to 1, the key idea is that each subarray have to be the shortest subarray that have the highest number of distinct numbers from index l to 1 which l is the last index of previous subarray. So initially set l = n and number of possible subarray is your answer
**sorry for my bad english
this is my code
C :(((
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!
Great Round. Esp for me , C and E.
Any hints for F?
one leaf or 2 leaves
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
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
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
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).
Yeah ,as you said, atleast if the removal of a(i) and b(i) before operations was not possible , a bit more complexity might have been added , and for time complexity reasons , you might have needed to store the even_pos and odd_pos sets and do binary search for searching of possibililty of making the pair , but because of that operation of removal , ig it was intentionally relatively made easy ..couldnt solve during contest through..I was very slow
took so much time on C, glad I moved on to other problems
liked the problems, feeling stupid that i overcomplicated c -_-
How to solve H?
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.
that doesn't work because you could get a better combination later (like a way smaller minnimum and just slightly bigger maximum). But if you just do that procedure for all the edges then it works
Ohhh I see, you are right! Thanks for the insight!
did u submit it? i have the same logic but still getting WA on 2
D is hard to implement for me ... and I think C and E have similar ideas and difficulties (maybe E even easier?)
D is just solving x+ny=a0 and 2x+(n-1)y=a1 . y = (2*a0-a1)/(n+1), x = a0-ny
wth was C test case 2???
fr.....
Speed forces, problems are too easy and boring. During C I looked it and in 10 minuets I was like who the hell cares and gave up on it. The last idea I had on it was to go from the back and have a set of n numbers of the entire input then read until you get n from back. Then repeat the process and count segments.
I could test it out but 50 hour hacking session.
What is the solution to F, I have no observation but the tree is a binary tree if ans > 0.
The topology of the tree is much more constrained than a binary tree.
Hint: how many leaves can there be ? What does that tell you about the number of nodes of degree > 2 ?
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.
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?
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 ?
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)
Oh, I should have solved D then. Thanks !
Really enjoyed this contest! Thank you :)
Why does the author think that 100 line of if else is cool for E, or my implemention is just dumb.
Maybe you overkilled it, just like I overkilled while thinking about the solution.323533480
i thought the same as a tester, but there are a lot of very neat solutions which arent casework bash
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://mirror.codeforces.com/contest/2117/submission/323499358
https://mirror.codeforces.com/contest/2117/submission/323470875
https://mirror.codeforces.com/contest/2117/submission/323448302
You have to wait until open hacking phase + system testing is completed, after which the contest will show as rated.
it will start to show as rated for me ??
coz now it is showing as unrated to me in the contest tab under profile , and yeah sorry to bother you , but its just that the system seems too new to me
Yes, it will. For me or any other participant right now this contest is showing as unrated.
did it started to show as rated ?
Ratings will update after system testing in a few hours.
brother it is still showing as unrated , is it normal ,like yours is still unrated ?? or just mine
It's normal dw.
Am I just stupid or E is much much easier than C? Like the whole logic is just 5 if statements... Where as I spent 90 minutes on C and still came up empty.
edit: oh nvm, i'm stupid
I agree, I took more time on C than A, B and D combined. If I had a little more time, I could have solved E.
Did anyone solve the C during the contest....
Yes: 323510174
yes bhai
cry amazing contest. The problems were atleast understandable for a newbie like me.
so this was my second contest and i did participate as rated will it increase my rating ??
till four contests it would increase >= 0
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://mirror.codeforces.com/contest/2117/submission/323482331
n=2,a={47,226}
you output yes, when the answer is no
Yes, thank you very much I have found the error, I was not checking for negative case
This was Nth time I read problem wrong. For D I spend more than 40 minits thinking we have to convert A(i) to 0 independently and solution for this became like a hell. I can done better but still this was my best contest ever very happy but still I think I am not gona become specialist this time also
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://mirror.codeforces.com/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. :)
orz
Can we solve D with Binary Search?
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.
why i ac D yesterday, but today i saw D is still in queue?
System Testing is going on which means, now your code is getting rejudged again on all test cases.
Persian Gulf
Persian gulf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~persian GULF~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
great contest
when rating update uwu
Guys im new in online contests. When i will get my elo? I solved A and B.
rating didnt updated?
Why haven't I rated this race?
hi
does anyone know why did this contest went unrated??
no idea, do u know why?
is this contest unrated?? or is this unrated only for me how to find out??
My rating is less than 1600,why it didn't rate me?
Did anybody get ratings for this round?
Nope
is this an unrated contest ?
Well, I have a possibly inappropriate question: Why hasn't my Rating been updated yet... (My rating is below 1600.)
Bruh relax It takes a little time You’ll get it soon,I haven’t received mine yet either
Thank you very much! Now I have received it. :)
No need for thanks, and congrats to you for getting the rating
Has anyone received their rating yet?
NOO
Unrated?
i didnt get a rating yet, i solved 3/8 problems in the contest.
bruh You’ll get it rating updates take some time
where is my rating, I'm starving. /cry
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.
maybe you participated unrated.
but i am in standings
As a tester, Help me figure out why this CPP solution works but not the same python one. CPP: https://mirror.codeforces.com/contest/2117/submission/323463628
Python: https://mirror.codeforces.com/contest/2117/submission/323479416
Wrong links?
My bad, fixed now
You are getting TLE because you are using hash set which can be hacked, Someone can generate a test that forces it to O(n) per insertion.
A solution for this is to hash the values to other random values
I tried applying this to your solution and it passed 323782302
Another solution is to use a sorted set which isn't built-in in python, but you can copy an already implemented one
I used Pyrival's implementation to sorted list, which is equivalent to a multiset in C++ and your solution passed using it: 323784215
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
predefine pow(2,n)%mod in some array than try it
Sadly it doesn't work I guess there will be some minor mistake in my code which I am not getting... Anyways, thanks for the suggestion
You pass the adjacency list
vby value in thecalc()function, which creates a new copy each time you call the function. Pass it by reference and it should pass.Hell nooo....
How did I miss this /•|•\ This is so sad and painful at the same time
Thanks bro for noticing this
my rating is still not updated
is everyone's rating updated ??
my ratings are still not updated?
It updated, you got a 0 delta (no gain/loss).
Your performance exactly matched with the expectations of your current rating :)
Questions were interesting and was fun to solve
I just tried the virtual contest today, these problem were so fun! Really regret forgetting to join the actual contest yesterday :')
Dear Codeforces Administration, I hope you are doing well. I am writing to clarify a serious misunderstanding that occurred during the recent contest on my account (ashutosh_iitrpr).
On 8 June, two of my close friends—whom I trusted implicitly—used my credentials without my knowledge or permission. They logged into my account in order to view and copy my code submissions. I only discovered this breach of trust when I received your warning email. Please understand that I didn't personally share my solutions or collaborate with anyone during the competition. I value fair play and have always respected the Codeforces rules. This incident was the result of my friends acting on their own accord, and I had absolutely no intention of violating contest policies. Kindly see to it and not to penalize me for wrong actions of my friends.
Dear Codeforces Team, I am writing to own up to my misconduct during the recent contest on user ashutosh_iitrpr. During the latest div 3 contest , I logged into his account without permission and copied several of his problem solutions. I recognize that my actions constitute a serious breach of contest rules and Codeforces’ honor code. I accept full responsibility for this violation and am prepared to face any penalties imposed by Codeforces. I sincerely apologize to ashutosh_iitrpr, to you, and to the entire community for undermining the integrity of the contest. I assure you that this will never happen again.
Hello Codeforces Administrators,
I wish to confess that I accessed ashutosh_iitrpr’s account without his consent during the recent div 3 contest. I copied and submitted some of his solutions under his handle, which was wrong and against Codeforces’ regulations.
I regret my actions deeply and apologize for the trouble caused to ashutosh_iittpt, to Codeforces, and to all fair competitors. I am ready to accept any sanctions you deem appropriate and will ensure such a mistake is never repeated.
.
Dear Codeforces Team,
I am writing to formally clarify that I did not engage in any form of cheating during Codeforces Div. 2 Round 1029. I understand the seriousness of maintaining a fair competitive environment, and I fully respect the platform’s rules and spirit of honest participation.
Throughout the contest, I worked independently and relied solely on my own understanding and problem-solving skills. Any resemblance between my solutions and those of others is purely coincidental and unintentional. I did not communicate with anyone during the contest or use unauthorized resources.
I genuinely enjoy participating in Codeforces contests as a means to improve my skills and measure my growth in a fair setting. Being flagged has deeply affected me, as I value my integrity above any virtual rating or rank.
If required, I am more than willing to provide my code, explain my thought process, or answer any questions regarding my submissions. I kindly request you to review my case and reconsider any penalties applied.
Thank you for your time and understanding.
I solved 4 questions in total A 323418615
include <bits/stdc++.h>
using namespace std;
define all(a) (a).begin(), (a).end()
define vec vector
define pb push_back
define yes cout << "YES\n"
define no cout << "NO\n"
typedef long long ll;
void solve() { int n, x; cin >> n >> x; vec a(n); for (int i = 0; i < n; i++) cin >> a[i];
int left = -1, right = -1; for (int i = 0; i < n; i++) { if (a[i] == 1) { if (left == -1) left = i; right = i; } } if (left == -1) { // No '1' in the array, segment length is 0 yes; return; } int segmentLength = right - left + 1; if (segmentLength <= x) yes; else no;}
int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr);
int tests; cin >> tests; while (tests--) { solve(); } return 0;} B 323415714
include
include
std::vector generate_permutation(int n) { std::vector perm;
if (n == 1) { perm.push_back(1); } else if (n == 2) { // No special pattern needed; just output in order perm = {1, 2}; } else { // Start with 1 perm.push_back(1); // Add numbers from 3 to n for (int i = 3; i <= n; ++i) { perm.push_back(i); } // End with 2 perm.push_back(2); } return perm;}
void solve() { int n; std::cin >> n;
std::vector<int> result = generate_permutation(n); for (int i = 0; i < result.size(); ++i) { std::cout << result[i]; if (i != result.size() - 1) std::cout << " "; } std::cout << "\n";}
int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
int t; std::cin >> t; while (t--) { solve(); } return 0;}
32344830 C
include <bits/stdc++.h>
using namespace std;
define all(a) (a).begin(), (a).end()
define endl "\n"
define vec vector
define pii pair<int, int>
define se second
define fi first
define pb push_back
define maxel(v) *max_element((v).begin(), (v).end())
define minel(v) *min_element((v).begin(), (v).end())
define yes cout << "YES\n"
define no cout << "NO\n"
typedef long long ll; typedef unsigned long long ull; typedef long double ld;
const ll mod = 1e9 + 7; const ll mod2 = 1e9 + 9; const ll mod3 = 998244353; const double pi = 3.141592653589793238; const long double EPS = 1e-9; const int MAXN = 1e5 * 5; const int LOGN = __lg(MAXN) + 1; static const int INF = 0x3f3f3f3f;
void solve() { int n; cin >> n;
vec<int> a(n + 1), nxt(n + 2), lst(n + 2); for (int i = 1; i <= n; i++) cin >> a[i]; int inf = n + 1; for (int i = 1; i <= n; i++) lst[i] = INF; for (int i = n; i >= 1; i--) { nxt[i] = lst[a[i]]; lst[a[i]] = i; } int pos = 1, cnt = 0; while (pos <= n) { int end = pos; while (true) { int nn = 0; for (int i = pos; i <= end; i++) { nn = max(nn, nxt[i]); } cnt++; if (nn > n) break; pos = end + 1; end = nn; } break; } cout << cnt << endl;}
signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int tests; cin >> tests; for (int i = 0; i < tests; ++i) solve(); return 0;} D 323441504
include
include
void solve() { long long n; std::cin >> n;
std::vector<long long> a(n); for (int i = 0; i < n; ++i) { std::cin >> a[i]; } if (n == 1) { // For single element, always "YES" std::cout << "YES\n"; return; } long long d = a[1] - a[0]; for (int i = 2; i < n; ++i) { if (a[i] - a[i - 1] != d) { std::cout << "NO\n"; return; } } long long denominator = n + 1; long long y_num = a[0] - d; long long x_num = a[0] + d * n; if (y_num >= 0 && x_num >= 0 && y_num % denominator == 0 && x_num % denominator == 0) { std::cout << "YES\n"; } else { std::cout << "NO\n"; }}
This is some text.
The rest of the te
int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr);
int t; std::cin >> t; while (t--) { solve(); } return 0;}
Hello Codeforces team,
I would like to clarify the warning I received from Codeforces regarding solution 323518201 for problem 2117G, which was flagged for significant similarity with other users' submissions.
I want to state that I did not cheat or collaborate with anyone during the contest. I wrote my code myself during the round.
You can see my solution here: https://onecompiler.com/cpp/43m69hfse
The idea of the solution came from a similar problem I had previously seen on Marisa Online Judge: https://marisaoj.com/problem/180
I implemented the solution independently based on that idea. Given that this problem and its concept are publicly accessible, and that many participants may have seen it before, I believe the similarity between my solution and others may be a coincidence due to this common source of inspiration.
I hope this explanation makes it clear that I am innocent and did not break any contest rules.
Thank you for your time and understanding.
Hello,
I received a message saying that my submission 323476100 for problem 2117D significantly coincides with many others. I would like to clarify that I coded my solution independently and did not share it with anyone.I did not use or upload it on any public platform.I coded independently using neovim locally so i can provide local code history to support my claim.
---------------------------------------- ~~~~~
include <bits/stdc++.h>
using namespace std;
int main() { int T; cin >> T; while (T--) { int n; cin >> n; vector a(n); for (auto &x : a) cin >> x;
if (n == 1) { cout << "NO\n"; continue; } bool ok = true; long long D = a[1] - a[0]; for (int i = 2; i < n; i++) { if (a[i] - a[i - 1] != D) { ok = false; break; } } if (ok) { long long den = n + 1; long long num = a[0] - D; if (num % den == 0) { long long y = num / den; long long x = y + D; if (y >= 0 && x >= 0) { cout << "YES\n"; continue; } } } cout << "NO\n";} return 0;
}
include <bits/stdc++.h> using namespace std;
int main() {
int T; cin >> T; while (T--) { int n; cin >> n; vector a(n); for (auto &x : a) cin >> x;
if (n == 1) { cout << "NO\n"; continue; } bool ok = true; long long D = a[1] - a[0]; for (int i = 2; i < n; i++) { if (a[i] - a[i - 1] != D) { ok = false; break; } } if (!ok) { cout << "NO\n"; continue; } long long num = a[0] - D; long long den = n + 1; if (num < 0 || num % den != 0) { cout << "NO\n"; continue; } long long y = num / den; long long x = y + D; if (x >= 0 && y >= 0) cout << "YES\n"; else cout << "NO\n";} return 0; }
~~~~~
These are the two solution,it is totally a coincidence that my solution matched to others.I respect the rules of codeforces please revoke all the actions taken to my handle.
Dear codeforces,
Please solve it as soon as possible, my contenst is showing skipped. Please correct that!
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
Hello, my submission for problem 2117C was flagged for coinciding with multiple other submissions. I want to clarify that I independently wrote my solution during the contest and did not share or access any external code or templates.
I now realize that this problem might have had a standard solution pattern that multiple participants arrived at, which could explain the similarity.
I understand and respect the Codeforces rules regarding fair play and will be more cautious in future contests to avoid any unintentional overlap or coincidences.
Kindly review my case. Thank you.
**Dear Codeforces team,
I sincerely apologize for the issue regarding submission 323507897 for problem 2117D. I understand that the solution matches with another ID that belongs to me (Compiling_error_404). On the contest day, I made the mistake of submitting the same code using two different accounts – one rated (Compiling_error_404) and one unrated (my main account).
At that time, I didn’t fully realize that submitting the same code from multiple accounts – even if both accounts are mine – is strictly against the rules. I now understand that this violates the Codeforces policy and could be considered multi-accounting and plagiarism.
I promise that I will never repeat such behavior again. I highly value this platform and have learned my lesson. Please accept my sincere apology and consider giving me a second chance.
Regards,
anupomkhan **
**Additionally, in my code submitted from the secondary ID (Compiling_error_404), I kept my usual template which includes my signature comment: // @author: Abdul_Alim // @CF: anupomkhan
This was never meant to deceive anyone, and I believe it further proves that I was not trying to hide the connection between my two accounts. I just misunderstood the rules regarding using multiple accounts in the same round — especially when one is unrated.
I hope this clarifies my intentions further. I am committed to fair participation going forward. Thank you.**
Hello, I understand that my solution appears similar to another participant’s. During the contest, I discussed some ideas with a friend briefly or shared logic informally without realizing it could lead to a violation.
I now understand this was against the rules, and I regret this mistake. It won’t happen again in the future.
s
I recently received a plagiarism warning for my submission 323473483 for Problem 2117D in Round 947 (Div. 3). I would like to respectfully clarify that I wrote this solution independently during the contest. I did not copy it from anyone, nor did I share it with others, or use public IDEs or any messaging platforms.
If the system found my solution to be similar to others, it may be because of a common logic path for this type of problem or the use of standard templates and helper functions that I always use in contests.
I’m fully willing to explain my solution logic, reasoning, and step-by-step approach if needed. I also want to share my custom template, which I use regularly in Codeforces contests. It includes common utilities I’ve written for faster coding and reuse:
These are utility functions I include to avoid repetitive coding during timed contests. Any similarity is purely coincidental and unintentional.
I value the integrity and fairness of Codeforces contests and request a kind re-evaluation of my case. I assure you that I’ve always played fair and will continue to do so.
Thank you for your time and understanding.
Sincerely, aakarsh_2004
I recently received a plagiarism notification regarding Codeforces Round 1029 (Div. 3), where my solution 323442227 for the problem 2117D was marked as skipped due to a match with two other users: "moee" and "shreyansh2605a".
I would like to respectfully mention that my submission (ID: 323442227) was made earlier than both of the others. I did not share my code with anyone, nor did I copy from any external source. I believe it’s possible that the similarity was either coincidental or a result of someone else copying my solution after I submitted it.
The problem in question was a math/number theory task, where it is common for multiple participants to arrive at similar logic or structure independently. Since only two other submissions matched mine, I hope this could be considered a borderline case rather than definitive evidence of misconduct.
I fully support Codeforces' effort to maintain fairness and integrity, and I sincerely request a re-evaluation of this decision based on submission timing and problem type.
Thank you for your time and for all the work you do for the community.
Sincerely,
Shivam
Codeforces Handle: Phoenix_1729
Hello, I received a message saying that my submission (ID: 323507467) for Problem 2117C matches many other users' codes. I want to clarify that I did not copy or share my code with anyone. I wrote my solution on my own during the contest. It’s possible that others copied from a common online source, or someone accessed my code without permission. If there's any way I can help verify my work, I’m happy to cooperate. Please consider reviewing this situation. I don’t want to be unfairly penalized for something I didn’t do. Thank you.
Hi, I received a message about my solution (ID 323515523) for 2117E being similar to others. I wrote the solution myself, but it’s possible that some part matched with others because I referred to some materials online during practice and may have unintentionally followed a common pattern. I also used an online IDE to test my code, which might have made it accessible to others unintentionally. I didn’t share my code with anyone. I’ll be more careful in future contests. Thank you.
How it's possible that you can't fix problem for months and I solve it in hours?
I have given this contestant I haave done 2 answers correct but still there is no increment in my rating can anybody help me out
NA
[user:sumku][contest:1029][problem:D — Retaliation][submission:323473269] Dear Codeforces Team,
I hope you are doing well.
I am writing to sincerely apologize for the issue related to my submission ID 323473269 for Problem 2117D, which has been found to significantly coincide with multiple other submissions.
I want to clarify that I did not intentionally share my code or participate in any dishonest activity. It appears that my solution may have been unintentionally exposed or leaked—possibly through public settings on an online IDE or another medium—without my knowledge. I now realize that even unintentional leaks are treated as rule violations, and I take full responsibility for this oversight.
As a sincere gesture of accountability, I respectfully request that this submission be excluded from rating, and that my other problems in the contest be considered for rating purposes. I accept this as a fair consequence for the situation and assure you that I will be much more careful moving forward.
This incident has been a serious learning moment for me, and I am now fully aware of the importance of safeguarding my code during contests. I deeply respect the values of the Codeforces community and will strictly adhere to the rules in all future contests.
Thank you for your understanding, and I appreciate the opportunity to clarify this matter.
Sincerely, Sumku Submission ID: 323473269