Привет, Codeforces!
Мы рады пригласить вас принять участие в Codeforces Round 1099 (Div. 2), который состоится 21.05.2026 17:35 (Московское время). Вам будет предложено 6 задач и 2 часа на их решение. Раунд будет рейтинговым для участников с рейтингом ниже 2100.
Раунд для вас подготовили: xoxo, Kuyan, FairyWinx, sunkuangzheng, TheScrasse и Vladithur. Также мы хотим выразить искреннюю благодарность людям, без которых этот раунд был бы невозможен:
FairyWinx — за отличную координацию раунда.
Нашим тестировщикам: Wansur, FelixArg, Fakewave, yanb0, Dinmiax, Vitaly239239, 300iq, Iura_Shch, fishy15, KiruxaLight, sadovan, larush, SomethingNew, __baozii__, _istil, madlogic, -firefly- и ABalobanov.
А также, разумеется, MikeMirzayanov и KAN — за замечательные платформы Codeforces и Polygon.
Распределение баллов будет опубликовано позже.
Надеемся, вам понравится этот раунд. Ни пуха, ни пера!
UPD: Распределение баллов за задачи будет следующее: $$$500 – 1000 – 1250 – 2000 – 2500 – 2750$$$
UPD: Разбор









Автокомментарий: текст был обновлен пользователем xoxo (предыдущая версия, новая версия, сравнить).
Auto comment: topic has been updated by xoxo (previous revision, new revision, compare).
Автокомментарий: текст был обновлен пользователем FairyWinx (предыдущая версия, новая версия, сравнить).
As a linger fan, I will sleep early this round.
Wow unexpectedly short announcement.
Hope the contest proceeds well!
very excitedd
Excited for the contest! All the best everyone!
As a newbie, I hope my code is shorter than this announcement.
xoxo i think you have wrote help in the announcement by mistake it should be held right ??
Yes, you got it right. The letter d just accidentally rotated itself mid-typing. Thanks!
As a participant, how to be a tester?
they may have private groups to discuss and organize contests and let people who have free time to test
Back in 2019 I once randomly got a message in CF from MikeMirzayanov asking if I would be available to test a round. Not sure if they still use this approach to recruit testers.
How clever of Makka-Pakka
hope to have some good conceptual questions not like the edu round 190
hope to have some good conceptual questions not like previous edu round 190
as per me edu 190 was a fairly good round
Thank you for this round.
Hope that the statements will be as short as the announcement
orz sunkuangzheng
Why is it the case?
How can a cheater prepare a codeforces round?
Maybe he (or she) prepared the round before got caught (like Jasonwei08, who tested a round before he got caught). Or, he is someone similar to chromate00, who cheated before but stop cheating and create rounds nowadays.
orz chromate00!
Yes, you are right. So why downvotes?
I think that people misunderstood you, thinking that you are supporting a cheater.
Sorry!
I love participating in DIV. 2
My first Div2 Send luck
Hope reach CM
help or held //
к чёрту
Наконец-то правильный ответ на пост!
дааа, научился к счастью
xoxo Could you add the score distribution?
Please add the score distribution.
Here you are!
Автокомментарий: текст был обновлен пользователем xoxo (предыдущая версия, новая версия, сравнить).
Auto comment: topic has been updated by xoxo (previous revision, new revision, compare).
The rise in points from C to D is (+750), crazy!!
This is my first CP contest ever, wish me luck folks!
GoodLuck xD
Thanks man,
Why do I have to complete a CAPTCHA for every submission I make, and it keeps failing to verify?
Isn't this a bit unreasonable? It will make me lose a lot of points for nothing.
It's been 15 minutes, and I'm still being treated like a 'robot'.
submit from submission tab
Why 2231B - Очередная задача на сортировку is a problem B and 2231C - Бурундучонок Тео и равенство is in Codeforces round.
$$$D$$$ was a good problem, thanks for the round!
Why 2231B - Another Sorting Problem is a problem B and 2231C - Chipmunk Theo and Equality appears in Codeforces round.
I swear I've solved C on Leetcode 2-3 years back, just can't pinpoint which problem was it. Anyone remembers?
why my sol in c get time limit
Hints
A. Construct an Array
Think about even and odd. What is the connection between parity and sum?
Sum of two odd integers is an even integer, so this can give you a nice isolation between the original elements and the sum. How?
Place all odd elements. They are pairwise distinct. Sum of distinct odd elements is also distinct. And their sum is even, so their sets do not intersect.
B. Another Sorting Problem
Think of a transformation. Inequalities are hard to deal with.
Think of difference arrays. How does the difference array of a sorted array looks like?
Array is sorted iff difference array has all non-negative integers. There is one special element in the original difference array that we are interested in. Which is it?
The minimum element in the difference arrays, suppose it is -27. Then, you know that you have this pair in the array $$$(x + 27, x)$$$. What can you claim about $$$k$$$ just by looking at this pair?
The minimum element in the difference arrays, suppose it is -27. Then, you know that you have this pair in the array $$$(x + 27, x)$$$. What can you claim about $$$k$$$ just by looking at this pair?
$$$k \geq |-27|$$$. Let's try $$$k = |-27|$$$. If $$$k$$$ is fixed, what strategy would you apply?
For a fixed $$$k$$$, greedy strategy works. If right neighbor is smaller, increment it by $$$k$$$, if it is still smaller, then you can do nothing about it.
C. Chipmunk Theo and Equality
How many operations are needed to reach $$$y$$$ from $$$x$$$?
Simulation works. Why?
Simulation terminates in $$$O(log(n))$$$ steps.
What are the possible final candidates? How many?
The final candidates are only the path taken by the minima. There can only be $$$O(log(n))$$$ such candidates. Try every one of them.
For $$$log(n)$$$ candidates, you iterate over each array element, simulate in $$$O(log(n))$$$. Total time complexity is $$$O(n * Log^2(n))$$$
My O(n∗Log2(n)^2) approach wasn't working,try multiple possible O(n∗Log2(n)^2) soln,every soln leads to tle,idk why :(
worked for me .. direct simulation
can you please share your code,I can't open submission.
ok .. code is at the bottom .. sorry for bad names in code
main idea is to iterate on all candidates, all candidates are values which we can reach from minimum value
what i did store all values which each number can reach untill it becomes 2 and update in map if any value is ==n in map then that is the contendor then iterate over vector and compute ur ans and take min but this time compl is o(n*n*log(max(v[i]))) still it got accepted https://codeforces.me/contest/2231/submission/375530544
whoa LOLOLOL !!!
my guess is somehow this line
if (it.second == n)is pruning a lot of values .. but can't prove italso in some cases we have value
1which we need to convert to2.. not sure how it is handled in your code .. maybemp[2]does itbut how one can guess pruning thing will it happen or not here atleast we are iterating over number of elements in vector so we get o(1e5) * smthing this smthing is dependent on vector + while loop how can i guess or show it is not quadratic
I find it not easy to strictly analyze .. but idea I am getting is if all numbers are different then values which have
mp[v] == nwill be lesslike 2 different element can have at max ~30 common values, so I guess you might not be getting too many values for which inner loop is executing.
is this essentially same as taking only one element and going through its possible final states
Ohh , I too thought this could be best complexity,like a trie format , ..was gonna try post contest..
because, map has higher constant than 2
oh didn't knew that,Thanks bro!
I didn't look at your code, but it seems that you used map or unordered map. My solution was O(n*log(max(a[i])) with a unordered map and it exceeded the time limit. I submitted another solution later without using unordered map and with a same time complexity and it passed. Therefore I guess it's the map's problem (map has a high constant)
In problem C, why it is
a[i] <= 1e9nota[i] <= nGetting TLE because of
mapdoesn't make sense to me+1
how did you use map in it ?
I didn't, I made a vector of pairs and sorted them (a retarded map if you ask me)
oh wow !! looks like
n logn logn, should pass ... I guess sorting such big array might be slow... can you please tryarr.reserve(n * 32)..so that I know it is not because ofpush_backI believe this suggestion will make the code faster, and I'll add write
arr.reserve(n * 64)notarr.reserve(n * 32)becausea[i]can go up to 1e9 (log base 2 of it is 32, and we may add one every time we divide, so 32 * 2 = 64)yes.. correct !!!
Because main part of this problem — write optimal code, because you use map with size nlog And this is too slow
In map u need to use map<pair<int,int>,int> pair cuz u need to store a[i] and the value u choose to make it .. i ignored duplicates and didnt use map cuz atmost operations are 3.5x10^8 <2sec but using map optimizes the code
i loved this round thank you!
On the problem statement of E.
Even though the second sentence adds a clarification, I think these two sentences are completely contradictory. I believe it would have been better to state this accurately from the beginning, for example: "Count the number of triples such that ..."
I do not think an inaccurate problem statement should be considered acceptable merely because a clarification is added afterward. At the very least, a problem statement should be written so that most readers can understand it naturally in the intended way.
For example, I think everyone would agree that a statement such as "Find the sum of A_i. Here, in this problem, sum means product" is clearly inappropriate. This problem statement felt similar to that to me.
100% Agree. Not only that, but the samples also don't clarify that. I had to write stress-tests for my WA2 solution, pass stress tests, get wrong answer and only then see that the problem asks for something clearly different. And the triplet part doesn't even contribute to the problem in a meaningful way, it's effectively the same with the subgraphs.
https://codeshare.io/5OYxBr
which test break would break for D? Thanks in advance
Feedback:
C shouldn't return a TLE because of
mapbut sadly the limit was an overkillFor problem E did you use fft or something to calculate the convolution or did you not have to calculate it at all?
It's a straightforward application of trick 7 from this blog.
omg your absolutely right this is not cubic, thnx
I thought of this during contest and finally got it working afterwards, 375580994
The path test case kept TLE-ing me so I added a special case for 1 child, which passed. I can't tell if the test cases have one that's a path of length 1000, each node having 1 other child, which might mess up this simple optimization, but I don't know how to check this (could also add a children[u] = 2 edge case then)
i don't think the intended solution for c involved using hashmaps i simply bruteforced it
u can simply iterate over all possible values the minimum value of the array can be converted to
In C i mean the observation that the numbers must be equal to a number that can be reached from the minimum is the most important part, no matter how it is implemented
Not really. Minima is not special. If you pick any number $$$a[i]$$$ in the array, then you can claim that the final answer lies on the path this element takes. Taking minima produces $$$O(log(n))$$$ candidates, but taking any random elements also produces $$$O(log(n))$$$ candidates.
You can go one step further and say that any 2 numbers $$$x$$$ and $$$y$$$ have a unique meeting point (with the exception of $$$1$$$ and $$$2$$$). Therefore, the entire array has a unique meeting point, so there are only 2 candidates, and not $$$O(log(n))$$$ candidates.
Submission with $$$O(n \cdot log(n))$$$ time complexity.
could'nt agree with D, easy implementation
In c hashmap was not required.
solved
bad C
Why does it force me to write a discretization?
dudes I use java BufferedReader and PrintWriter but the problem C was giving TLE I had to rewrite the same logic in C++ for it to be accepted this is not fair.
Just tried to brute force C and it passed Is that the optimal solution?
how did you find what values final equalized value can take ?
The way I checked was if high== low high-> largest element and low -> lowest element Then answer is done If high=low+1 and high is divisible by 2 the final value will be high( high=2 and low=1 is edge case handle separately ) Any other case just implementthe algo on high
Depends on your brute force. It takes O (log N) steps for a number to reach 1 or 2. So in my head, a good brute force approach should work.
yeah it worked, like storing all reachable positions (log(maxA[i]) then iterating over them and updating simultaneously. It gave me TLE on 20 th case but later on when i changed long long to int, it passed the test cases.
There's no need to do that, there's a simpler approach:
Notice that any a[i] only decreases. It follows that at each step we must decrease the i-th number.
For optimization, we can use a map.
Edge case: when the map size is 2, the answer will be count(x — 1) if x == 0 mod 2 and x != 2, and when x == 2 the answer will be min(count(x), count(x — 1))
a[i] does not only decrease.
a = {7, 8, 8, 8}
optimal solution is increasing a[0] -> 8
Here the map size is 2, see point 3. This is an edge case when the difference between map elements is 1
In C, if we take only the first 2 numbers in the operation sequence of least element which also are in the operation sequence of all numbers, why won't testing them be sufficient to find the minimum answer?
Sounds like it should work.
i did the same thing but it didnt pass 375551055
i did this for c i am not really sure if its optimal tho i am basically tryna simulate paths from every number down to 1
tricky B for me ... I got idea for C quickly but you have to code it in fast way.
For problems like $$$B$$$, I always visualize them as mountains with peaks at height $$$a_i$$$, and you can think of the operation as "lifting the mountains up". So when $$$i-1$$$th mountain is taller than $$$i$$$, we need to lift the $$$i$$$ th mountain by atleast $$$a_{i-1} - a_i$$$. This visualization always helps me solve such problems.
I was confused about what happen to next element of the element we pick up, as we add 'k' to all elements... what if that becomes larger than next element ... so I was not sure of correctness.
although because now
pretest = main test, I just submit my random ideas as I can verify it fullyDude I was so fed up of C I had to rewrite my whole Java code into C++ for it to be accepted.
did it accpeted?
I did lots of optimisation for my java code , i am precomputing min distance still it is getting TLE like why?
`int t = sc.nextInt();` ` while (t-- > 0) {` ` int n = sc.nextInt();`long a[]=new long[n];` Map<Long, Integer>map=new HashMap<>();`for(int i=0;i<n;i++){a[i]=sc.nextLong();}Map<Long, Long>mp=new HashMap<>();long ans=Long.MAX_VALUE;` for(int i=0;i<n;i++){`long temp=a[i];` Set<Long> set=new HashSet<>();`map.merge(temp, 1, (x, y)->x+y);` long it=0;`set.add(temp);` mp.merge(temp, it, (x, y)->x+y);`if(map.get(temp)==n){ans=Math.min(ans, mp.get(temp));}while(true){if(temp%2==0){temp=temp/2;}else{temp++;}` if(set.contains(temp))break;`map.merge(temp, 1, (x, y)->x+y);it++;` set.add(temp);`mp.merge(temp, it, (x, y)->x+y);` if(map.get(temp)==n){` ` ans=Math.min(ans, mp.get(temp));` ` }` ` }` ` `}``For C:- I am trying to understand why this Java solution gets TLE.
Idea:
For each number, I generate all reachable values using:
I maintain:
map[value]= number of elements that can reachvaluemp[value]= cumulative operations needed to reachvalueSo I am not recomputing distances; I accumulate them while traversing.
Whenever
map[value] == n, that value becomes a candidate answer.Code:https://codeforces.me/contest/2231/submission/375593971
Expected complexity:
O(log ai)sum(n) ≤ 1e5So I expected roughly
O(n log A).Is the TLE mainly due to:
HashMap.merge()overhead?HashSetfor each element?Longboxing/unboxing?I want to understand the exact reason for TLE rather than replacing the approach.
https://codeforces.me/contest/2231/submission/375542810
why my code will be tle?
hash collision & the constant is too big
try using just one unordered_map, passed for me in around 1700 ms unordered_map<ll, pair<ll, ll>> where you store the frequency and count
And i guess there are no test cases where extreme collisions happen
Thanks a lot! Turns out I just had to use an unordered_map because of the large constant, and got AC immediately after... I was scared to use unordered_map due to to the risk of rehashing.
what's the approach for problem B :(
what's the approach for problem B..? :(
`Why does my O(n log^2 n) solution for problem C get TLE on test 4?
`
Why does my O(n log^2 n) solution for problem C get TLE on test 4?
https://codeforces.me/contest/2231/submission/375542810
I think I same with you. I also TLE on problem C I don't know why
because of unordered map, he can work for O(N^2) at worst
Because appeal to map (unordered too) with size 5e6 is too slow, and if you store only numbers, which from proccess for the first element — it will be work fast
can I see your solution?
okok. I understand! thank you
thank you cf, had a good time.
Problem E: Did anyone try small to large optimization with a twist that "small" and "large" is on heights? Did it pass the TL?
I assume it should be $$$O(n)$$$ per DFS, and running from every possible root you get $$$O(n^2)$$$, but it doesn't pass for me, unsure why. 375550780
If that's not the solution, what's the good straightforward alternative? For me the small to large seemed like the most straightforward approach: split answers in two- and three-ways, two-ways are trivial, and for three-ways we need to combine two depths from center vertex => small to large.
"For me the small to large" all this solutions work (that i know) in O(n^2) with naive merge, because you any pair of vertex calculate only in their LCA
The idea is not exactly this one, it's a fair small to large, and the swapping is important.
The idea is that if for $$$v$$$ you have two subtrees, one of depth $$$A$$$ and another of $$$B \lt A$$$, and you combine them in $$$O(B)$$$, the B becomes hidden in the combinator result that has size A. And because depth B requires B vertices, you can estimate by coin method the amortized $$$O(n)$$$.
That's a cool technique tht I use once in a while, and I can't understand why it failed me here.
Yeah, it works, i just got destroyed in too many small allocations for vectors, had to pre-allocate them 375573721
I did do the $$$ O(n) $$$ small to large, but I didn't run it from every root, I did one dfs, with $$$ O(n^2) $$$ dp: 375530382
I had same idea, and my solution pass. 375531942
Hi, I did small to large sort of. My AC implementation is here: https://codeforces.me/contest/2231/submission/375566090
I broke it down as follows:
Any group of 3 nodes either forms a simple path, or a Y-shape.
For simple paths we have two cases: -The LCA of all 3 nodes is one of the three nodes -The LCA of all 3 nodes is a different node
We could solve these separately or together in many ways.
The Y-shaped cases are more interesting: For a Y-shape, the LCA of all 3 nodes is not one of the three nodes. call this LCA
L.We could have all three nodes come from different children's subtrees of L. We could also have two nodes come from one child's subtree of L, and the third node comes from a different child's subtree.
This is the part I used small to large merging for. For each node we treat it as an L. I want to know how many nodes in L's subtree have a distance of X, and how many pairs of nodes have a distance of X. We can aggregate these together in the merging process to update the result.
I think I probably did not do it the cleanest way, but I used the standard "offset" trick where each node stores an unordered map and when we bubble up we shift the offset by 1.
The "Time limit exceeded on pretest 4" of problem C killed me. Good Bye candidate master and Hello expert !
Bruhhhh Same TLE on 4th test case(-5). Good Bye expert and Hello specialist !
only pretest 4? Check out my first submission 375503502
Failing D on pretest 2, could not figure out at all
Can someone please help me with any counterexample to my code for problem B of this contest? I can't see what's wrong here... Please ignore the bad formatting, I've added comments so that I can explain what I'm trying to do
I was doing something similar to you initially..try this test case
It's answer is yes(choose index $$$ 2, 3, 5$$$ and increase them by 2) Hope it helps
Can someone please help me with D??
I was able to find out two conditions that's it —
How to proceed from here?? Thank You.
So we can maintain a visited array v. For all i, v[i] is set to 1 if we know the value of b[i], otherwise we set it to 0. So using your first condition, we can set v[i+1] to 1, whenever c[i]<c[i+1], since we know what b[i+1] is. Also b[0]=a[0]
Now we iterate from right to left(i=n-1 to i=1). If for some i, v[i]=1 (which means we know b[i]) and a[i] as well, then b[i-1]=b[i]-a[i-1], and therefore we know the value of b[i-1] as well, and we can set v[i-1] to 1. In the other case, if both v[i-1] and v[i] is 1, then we know both b[i] and b[i-1], and therefore, a[i]=b[i]-b[i-1], and we set set s[i] to '1'. In the case, that we know all a[i],b[i] and b[i-1], we just check if a[i]=b[i-1]-b[i], if this condition does not hold, there exists no valid construction
So now, we will iterate from left to right. For each i from 1 to n-1, we will make 4 cases:-
Case-1 s[i]='0', and v[i]=0, we just set a[i] to some negative number of large magnitude, and update b[i]=b[i-1]+a[i]
Case-2 s[i]='0', and v[i]=1, we know b[i] but not a[i], we set a[i]=b[i]-b[i-1]
Case-3 s[i]='1' and v[i]=0, we know a[i], but not b[i], so we set b[i]=b[i-1]+a[i]
Case-4, s[i]='1' and v[i]='1', we don't need to do anything since both a[i] and b[i] are known
Clearly at any i, we know a[j] and b[j] for all j from 0 to i-1, due to the nature of the construction, hence all updates to a[i] and b[i] will be correct.
So why is it so important to set a[i] to a large magnitude negative number in case-1. This is because if there are large known a[j], and you use say, a[i]=-1, for some j>i, b[j] could exceed c[j].
As a final step, you just check if you construction violates any constraints (either a[i] or c[i]). If it does, then there exists no other construction, and if it doesn't you can just print your construction. For more clarity regarding this why this step is required, check sample test case-6
Of course, the above paragraph also works as proof of correctness of the construction
Thank you so muchh!
D was a nice implementation problem
D was a nice implementation problem.
Мне не понравилось
MikeMirzayanov Please allow unofficial participation of contest like atcoder. 😭 😭
ConstrumentationForces
In C , My code 375545444 got accepted without using Hash map. Why using Hash map ? is it creates any big difference here?
Pretty good contest, it would be better if the TL of problem C were larger.
Anyway, I'm glad to reach CM again in this round, especially on my birthday.
This is a wonderful birthday gift for me!
well, C will come in my nightmares now, thank you very much
such a great contest ! is there an editorial .
Very good contest!
Problem C was really fun! I found an $$$\mathcal{O}(\sum \log a_i)$$$ solution that doesn't use data structures at all: 375569790.
did something similar, but i overcomplicated it too much using multiset+map :p
Right, lots of people did something along those lines, but the multiset/map adds an $$$\mathcal{O}(\log n)$$$ factor to the time complexity for a total of $$$\mathcal{O}(\log n × \sum \log a_i)$$$ which sometimes causes a timeout.
And of course, there are solutions that use a dictionary/hash map instead of an ordered map. This is faster and theoretically even O(1), but this O(1) still adds a significant overhead in practice.
I wanted to share a solution that is strictly $$$\mathcal{O}(\sum \log a_i)$$$ without any overhead from data structures.
Awesome solution! just did a cpp implementation of your idea : 375604689
FOR C I DID LIKE THIS PLEASE GIVE A LOOK :)
I first sorted the array.
Observation: the final array must become some value lying on the path of the smallest element. Example: for
3,4,5, path of3is:3 -> 4 -> 2 -> 1So possible final values are
{3,4,2,1}.For every candidate
pfrom this path, I calculate total operations needed to convert every elementaintop.Example for
p = 2:3 -> 4 -> 2= 2 steps4 -> 2= 1 step5 -> 6 -> 3 -> 4 -> 2= 4 stepsTotal = 7 steps.
To compute steps for one element:
Trap: for
p = 3anda = 4:4 -> 2 -> 1 -> 2 -> 1...This becomes infinite because after going below
p, reachingpagain is impossible.So during division, if
p - a >= 2, I return a large value (1e5) so that candidatepis ignored.Complexity:
O(log Amax)O(n)O(log Amax)Overall:
O(n * log²(Amax)). WHERE AM I WRONG :)you need to use unordered_map, its theoretical complexity is O(1).
Ok But why the above thing fails
Bro your submission difference between this 375524522 and this 375528817 you got AC after 7 min of WA 16 and your code is fully changed man just checkout variable names and comments would you like to explain? as well as this [contest:https://codeforces.me/submissions/aryansapla/contest/2220] your contest got skipped
Editorial?
I hate TLE on test 4.
i had that too. It can be solved by changing map to unordered_map.
Bruh, I used unordered_map and it still TLEd
Even the complexity was nlogM and it should pass the constraints
your implementation is quite badly formed, you can remove some useless "for".
Where is the editorial ?
Editorial please?
No editorial even after 12 hours of the contest, bad !!!!
for each i perform abi:=abi+k Doesn't it mean that those b subsequence are indexes of array a Or i am interpreting the question wrong?
EDITORIAL?
where i can see the edutorials,tutorials,solutions ?
A good extension of question B is to find the number of valid k
has the editorial been released
When is the editorial going to be published
Where is editorial?
Here's my solution for problems A-C (sorry for bad explanation?)
You can just output all numbers from $$$n + 1$$$ to $$$2n$$$, or all odd numbers from $$$1$$$ to $$$2n - 1$$$
For every index, just calculate the least value of $$$k$$$ to maintain the non-decreasing constraint (
last_value - current_value).After that, I loop again and increment it (include it in the subsequence) if its less than the previous value.
Use a map (value -> count), for every element simulate its steps until it reaches $$$1$$$ (if the starting value is already $$$1$$$ then also increment value $$$2$$$ in the map).
After that, check every value if the count equals $$$n$$$ (every element can reach it), simulate every element to get the sum of steps, then output the minimum number of steps.
(For some reason using map to store value -> (count, total steps) TLEs so I simulate it after)
Hi, my approach to problem B looks similar to your solution. Can you help me identify where my algorithm is wrong ? I am getting WA on test 2.
Submission Link — https://codeforces.me/contest/2231/submission/375505094
I fixed it a little bit:
Updating
prefMaxin the if condition (line 19 in the fixed submission)Incrementing
a[i]if its unmarked and is less than the previous value (lines 33 and 34)Here's the fixed submission 375652032
Thanks for correcting my code!
I found out that the main issue was that I was not updating the elements that were not marked. But that could be needed if after incrementing the current element it becomes greater than the next element which was earlier not smaller than than the prevMax.
I used map in problem C why it takes TLE ?
i think use only 1 map and calculate sum of steps if all elements can reach it
I used first map to check if the element can be reached by all other elements and the second to calculate the steps Why should I Use one map isn't that take the same complexity?
2 maps will cost double the time compared to 1 map
ah OK thx
Drop the Editorial please
whens the editorial up?
Auto comment: topic has been updated by FairyWinx (previous revision, new revision, compare).
Recieved a mail regarding solution coinciding. I am not sure how do you find those solutions same and from my side no cheating took place. Pl[submission:375526933]ease look into this. This was my submission 375526933 And the violated one has http://contest/2231/submission/375517996
editorial pls.
I did not intentionally copy any code. I wrote the solution myself during the contest. The approach for this problem was common, so the solutions may look similar. I will be more careful in future contests. Thank you.
Just received a notification stating that ratings for the last rounds have been temporarily rolled back. Can anyone educate me on what that means?
Dear, organizers.
I would like to clarify the situation regarding my solution (submission:375528371) for problem 2231F.
Near the end of the contest, under time pressure, my friend and I used AI-generated code assistance for problem F and submitted the solution without properly thinking through the consequences or the contest rules. Shortly afterward, we realized that this was inappropriate and violated the competition rules regarding external assistance.
We take full responsibility for this mistake. There was no intention to collaborate with other contestants or deliberately abuse the system, but we understand that using AI-generated code during a rated contest is unfair and against the rules.
We sincerely apologize to the organizers and the community for this behavior. We fully accept any decision regarding disqualification, rating rollback, or other penalties.
This was our mistake, and we will make sure not to repeat it in future contests.
Thank you for your understanding.
Dear Organizers,
I am writing to appeal the decision regarding my solution (submission ID: 375501684) for problem 2231C, which was flagged for coinciding with other solutions. I fully respect the integrity of the platform and the necessity of plagiarism detection. However, I believe my case is a false positive caused by the problem's limited solution space and the natural convergence of optimal coding patterns.
I would like to detail my development process, supported by the actual code I wrote, to demonstrate that my solution is the result of independent debugging and optimization.
My first submission(id:375495165) used unordered_map to track the total steps (to) and count (c) for each reachable value. The logic involved simulating the process for each starting number and storing results in hash maps. This approach was intuitive but resulted in a Time Limit Exceeded error due to the overhead of hash operations and the complexity of the simulation.
After identifying the performance bottleneck, I redesigned the algorithm. Instead of using hash maps, I switched to a vector of pairs (value, steps). I collected all reachable states for each starting number, then sorted the vector and aggregated steps for each unique value. This eliminated hash collisions and improved cache efficiency, leading to a successful submission.
Furthermore, this contest is of utmost importance to me — it is, without exaggeration, the best performance I have ever achieved in my entire life. I sincerely hope that it will not be unjustly invalidated due to a false positive in the similarity detection.
I fully support Codeforces' anti-cheating measures and understand the need for automated detection. However, I respectfully request a manual review of my submission history, which clearly shows the evolution from a TLE solution to an optimized one. This pattern is inconsistent with code copying.
I am confident that a thorough review will confirm my innocence. Thank you for your time and for maintaining such a fair and competitive platform.
the worst contest ever
Hello,
I received a coincidence warning for my submission 375528547 for problem 2231E. I would like to clarify that I solved the problem independently and did not intentionally copy any code.
The solution uses standard competitive programming techniques and common approaches that are widely available in public resources and Codeforces blogs before the contest. Because of this, some structural similarity between solutions may naturally occur.
I did not share my code publicly during the contest and was not involved in any intentional plagiarism or leakage.
I respectfully request you to reconsider my submission.
Thank you.
Dear Codeforces Team,
I would like to kindly follow up regarding my previous appeal about the coincidence warning issued for my submission 375528547 on problem 2231E.
I understand that the review process may take time, but I would be grateful if you could reconsider my case when convenient.
As mentioned in my earlier message, I solved the problem independently and did not intentionally copy any code. The solution is based on standard competitive programming techniques and common approaches that were publicly known before the contest, which may naturally lead to similarities between submissions.
I did not share my code during the contest and was not involved in any plagiarism or information leakage.
I respectfully request a review of my submission and would appreciate any update regarding the status of my appeal.
Thank you for your time and consideration.
What about the gifts.
C was good tbh!!!