Hello! Codeforces Round 1027 (Div. 3) will start at May/26/2025 17:35 (Moscow time). You will be offered 7 problems with expected difficulties to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600 or higher, can register for the round unofficially.
The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of open hacks. After open hacks all accepted solutions will be rejudged on successful hacks.
You will be given 7 problems and 2 hours and 15 minutes to solve them.
Note that the penalty for the wrong submission in this round is 10 minutes.
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 point of 1900 or higher in the rating.
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.
Problems have been created and written by our team: myav, Gornak40, ibraevdmitriy and Vladosiya.
We would like to thank:
MikeMirzayanov for Polygon and Codeforces platforms.
imirdy for red testing.
Be_dos, KseniaShk, pengin_2000, Eugene312 for yellow testing.
Kmes for purple testing.
RobinFromTheHood, AlphaMale06, Kosya, itz_pabloo, umezo, donovilia2007, l-_-l for blue testing.
jbrenorv for green testing.
Good luck!
UPD: Editorial is out!








First unrated Div3 :D
Finally after 2 years on cf, i am able to post this picture!
Why is there a random red dot near his face?
Someone wants to snipe him
Hardwork pays off man ! You are worthy to post that pic <3
This guy looks like my professor
Interactive problems.. Where?
Considering I have never solved an interactive problem in contest, I'm a bit glad there are none here (personally find them a pain to test)
Me too.
You guys test interactive problems, eh ? Just submit, prove by AC
Give them a try, interactive problems are fun to solve!
Overlaps with NAC :(
True but also I'm not good enough to qualify, so ehh maybe next season my team will get there
Yeaaaah! Vladosiya Div3 rounds are back <3
Have we stopped the authors snap trend? I don't see it anymore in recent blogs.
Is there any interactive problem jn the today contest
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.
Thanking everyone working behind the scene to make these contests possible. Hoping for a positive delta ♥
Good luck! And get postive $$$\Delta$$$.
Please tell me I'm not the only one who found the B problem harder than the C problem.
you're not the only one, i also found B harder than C
fr
i found B harder than C and D harder than E
submitted F 10s before and still Wrong answer :(((
did you really thought that checkers would go numb in the last 10s?
naahh, just had adrenaline rush
I enjoyed the contest, especially problem $$$F$$$
Thank you for this contest ^_^
what did you do to get the minimum, because I thought of bitwise dp but it was to late to implement it at that moment?
well, I used normal dp
dp[x] = min(dp[y] for each y such that y = x / z and z <= k) + 1
Can you please tell about the your dp state. What does dp[x] mean ?
here is the code for my dp
dp[x] is the minimum number of operations needed to reduce x to 1
and each time, I will do like what I mentioned in the previous comment
I will take all the divisors of x, and if a divisor is less than or equal to k, I can take its dp value, I will take the minimum between all possible values, then my dp[x] is this minimum value + 1
what's the time complexity of it?
I'm not sure what is its exactly time complexity
because for each number $$$x$$$, it will go to its divisors and so on, I don't know if there is an approximated time complexity for it or no
you just guessed it would fit under time limit?
There can be cuberoot(n) divisors of a number n, so tc should be n^2/3. Thanks for the help. Crazy consistency orz
How did u get n^2/3? Shouldn't it be n^4/3?
(n ^ (1/3)) ^ 2 = n ^ (2 * 1/3) = n ^ 2/3
no each number can have upmost n^1/3 divisors and we can have any any number while transitioning?or is it that we can have upmost n^1/3 numbers while transitioning?
we'll have only the divisors of n at each step which can be atmost n^1/3.
how it is n^(2/3) why not n^(1/3)?
See the code, we are iterating over all the divisors for a given divisor. A for loop in a recursive function or equivalently 2 nested for loops
Thank you ^_^
first time to know about this time complexity, thank you for sharing it!
Can u tell me for which test case my code will not work , problem F small operations 321700977
you have two things wrong in your code:
into these two lines:
okay thanks
any reason why i can't use greedy , i didnt get
imagine the case where you have to these numbers in your divisors and you will use them
2 2 3 3
and $$$k$$$ is equal to 6
if you used some greedy, like multiplying from the end, or from the beginning, you won't get the correct answer, will end always with 3 operations, but with dp, you will get 2 operations
it was just a little example, there are more examples where greedy doesn't work
if you used greedy to multiply the end with beginning, you will get WA on test3, so, use dp for it
In greedy, if i take the largest possible value that can fit and keep doing it. I can pass this case in greedy. Can you tell me a test case where this idea fails?
I got WA in TC 3 but cant figure out any case where it fails.
What do you mean by taking the largest value?
2, 2, 3, 5, 13 k = 42
Here in the first operation, I will take 13, and then I won’t take 5 as the product will exceed k, so I will take 3 instead. I won’t be able to take any more numbers in this operation.
In the second iteration, I will take 5, 2, 2.
My idea is: I will iterate through the array multiple times from backwards. Each time, I will take a value if the product doesn't exceed k, otherwise I will skip it and try to pick the next one.
In which case it fails?
For example, if you have:
k = 28,
7, 3, 3, 3, 2, 2.
Your strategy would give as an answer:
7,3; 3,3,2; 2
but the best is:
3,3,3; 7,2,2
C and E were nice, B and D were gay. Thanks for the round.
best comment
I enjoyed solving D :)
The lesson I learned from this is not to participate in contest when I have a fever :(
can someone confirm if there is a way to solve F like this?
let the prime factorization of $$$ x = {p_1}^a * {p_2}^b * ..... * {p_n}^c $$$
and $$$ y = {q_1}^m * {q_2}^n * .... * {q_l}^o $$$
Then suppose that none of the prime factor $$$ \gt k $$$, then we need to divide $$$ x $$$ by some factors and multiply by some. Let those be $$$ div$$$ and $$$mul$$$. Now, the problem is just to find minimum number of subsets of both these new variables such that in such subset $$$ product \lt = k $$$ but idk how to do this step. can someone help me?
I solved it like that. Think about shortest paths and a careful implementation.
You can use djikstra , suppose you are at starting node 1, and ending node is "div". The factors of "div" (which are less than k) will be the edges of the graph, so you can use djikstra to find minimum number of operations required to move from starting node to ending node using these edges.
Man, idk why i am getting wrong answer on test3 in F. wasted 10mins on debugging D where i was forgetting to take max with last index which was outside loop. I think i will be on edge of becoming expert :(.😭😔😫
Nice round though
Me too, but then I realize that greedy was imcorrect, you should implement dynamic programming.
My submission 321571955 here.
can you explain your dp solution..thnkx
We want to make $$$x$$$ by
mulanddivoperations to $$$y$$$, so reduce the problem to make $$$x, \, y$$$ to an identical integer by onlydivoperations.So let's precalculte the factors of integers not exceed $$$10^6$$$, $$$d(10^6) = 240$$$ (here $$$d(n)$$$ means number of factors of the number with the most factors which not exceed $$$n$$$). We only try to use factors of $$$x$$$ to reduce it.
I use a dynamic programing which is like BFS, that can be convenient to finish dp. And at last, we only need to enumerate all the factors of $$$x$$$ to see if $$$y$$$ can be reached.
Why was this contest not rated for me?
What is the intended solution for problem F? My solution takes a bit too long to run.
It is Sieve of Eratosthenes only, but you have to sort the queries first and then build up your sieve as $$$k$$$ increases.
My 321514527 without Sieve of Eratosthenes is currently passing, feel free to hack. (Someone already tried) :)
brooo
it is already hacked
Well its not the Sieve of Eratosthenes that got hacked. I was just using a dumb methond of finding divisors of a number. This 321547015 passes easily
Say gcd(x, y) = g, Then the problem reduces to finding the same answer for (x/g, y/g), say x1, y1
Additionally, since x1 and y1 are co-prime, we just need to find a way to remove all of x1 by division and multiply all of y1 by multiplication.
So if we define a function, f(x) => minimum moves to make x from 1 through repeated multiplication by a number <=k, we just need to find f(x1) + f(y1)
Now for any number X, it has ~ (X^1/3) divisors.
So you can run a brute force dp to try to build X based on the current number and the next number you want to reach to. This will give ~(N^2/3) time complexity per number.
And since sum of all X and Y is less than 1e8, sum of their (2/3) powers will also be lesser than 1e8 which would fit the given time constraints.
can we do it with graphs?model nodes as numbers from 1 to max(x,y),and edges if transition is possible.I guess they will be of order zlogz where z=max(x,y) and then run dijkstra?
Can we calculate f greedily instead of dp ? I mean for f(x) does dividing x to its biggest divisor (that is lower than or equal to k) always yield the optimal answer ?
The greedy idea will not work in the 7th input of sample cases itself.
I spent 30 minutes just to figure that out.
For me it was 15m, because I googled "online factors calculator"
Yaa i guess I wrote a greedy solution, which is passing feel free to hack it, 321527163
Not exactly, but I submitted a greedy solution that keep taking the prime factors of $$$x$$$ as long as their product is $$$\le k$$$. Just taking them in decreasing order is not optimal and failed test 3. But repeating this greedy a bunch of times with random orderings passes all tests. I think this might still be hackable though 321492564.
I also have a greedy solution which takes the largest number <= k which also has the largest divisor of x and divide x by that number. id: 375359477
can you please break down how you calculated that N^2/3 time complexity?
bfs
What's wrong in my D? https://codeforces.me/contest/2114/submission/321409020
If area==n-1, area++, is wrong, you assume the only way to get n-1 is 1*n-1, what if n-1==6 and you had 2*3=6, so area would have been min(3*3,2*4)=8
Ah okay, got it bruh. The other cases never crossed my mind.
if(area == n — 1) area++;
area++ should be done regardless and if(area == n-1) then area +=min(side1, side2) because this would increase either length or breath. here side1 and side2 are two sides of the rectangle formed.
if the area is equal to $$$n - 1$$$, then you have to add $$$min((xmx - xmn + 1), (ymx - ymn + 1))$$$ to this area, not increasing the area value by 1
For problem F, I reduced it to: 'Given a list of numbers, find the minimum number of groups such that the product of every number in each group is less than k.' But I found this problem hard any hints?
these were the possibilities I thought of, and one of them ended up AC: dp, shortest paths, greedy. Think about it.
https://cses.fi/problemset/task/1653
But there is a way easier solution.
Since I didn't come up with it myself, I won't explain it. Instead I'll just ping ludo. and tell him to explain it instead.
It's funny because this problem is NP-hard. I also thought of this but the case $$$2^{26}$$$ made me rethink my approach. Anyway, the idea is basically
$$$dp(i) = 1 + min(dp(i / d))$$$
Where $$$d$$$ is a divisor of $$$i$$$ that is not 1 and is ≤ $$$k$$$. Also the base case $$$dp(1) = 0$$$.
Btw the reason why this problem has an easier solution is because there is a small number of distinct states. For example, consider the bin-packing variation where we take the sum of elements (instead of product). You can encode the state of the problem as a frequency table of the numbers we have (using a hash map, for example). Then the number of distinct states are $$$\prod_i freq_i + 1$$$. As all numbers may be distinct we have up to $$$2 ^ n$$$ states. In the multiplication case we have exact same scenario, but as the product of everyone $$$\leq 10^8$$$ it follows that we can't have a very large value of $$$\prod_i freq_i + 1$$$. In fact, for this particular problem, the elements you want to separate in bins are the prime factors of some number $$$n \leq 10^8$$$, so it follows that the number of distinct states is exactly equal to the number of divisors of $$$n$$$, which is $$$\leq n$$$.
how is it NP hard? i think the time complexity of the dp solution with the states and transition you mentioned is nlogn
n*n^(1/3)
the bin packing problem is NP hard ($$$n \cdot 2^n$$$ using dp), but the number of prime factors of a number is logarithmic ($$$log n$$$), so together the log cancels the exponential ($$$\log n \cdot 2^{(\log n)}$$$ => $$$n \log n$$$)
You can also solve it by DP on divisors in O(divisors ^ 2) my submission
ugh, in F for 40-50 minutes i thought we have to do SOS DP :(
same bro istg
thats second time, this is happening with you lol. :P
I think we're cf twins :)))
Pls tell your approach for F
my solution is kinda different first i do what everybody does ->>>
Say gcd(x, y) = g, Then the problem reduces to finding the same answer for (x/g, y/g), say x1, y1
Additionally, since x1 and y1 are co-prime, we just need to find a way to remove all of x1 by division and multiply all of y1 by multiplication.
So if we define a function, f(x) => minimum moves to make x from 1 through repeated multiplication by a number <=k, we just need to find f(x1) + f(y1)
now calculation of f(x) is different for me ->>>>
first thing to note is that, we can do something greedy here, we can always choose such subsets of prime factors of x which when multiplied is <=k basically over all subsets, choose that subset which gives maximum product less than k. subtract that subset from total prime factors and repeat this process till factors are empty. this process will run atmost 20 times.
but choosing a subset is 2^20, so this will be slow as sum of x can be up to 10^8
but if we choose subsets recursively we can return early and not all 2^20 subsets will be checked,
basically if k is large i.e., big subsets are created then we will repeat the process way less than 20 times and if k is small then we will return early not all 2^20 operations will be done. i don't have proof for this though. it might so happen someone create a test which would TLE idk.
I thought about this greedy approach but could not implement it. Thanks for the help :)
Glad to know I wasn't the only one to try it, ended up spending way too long on it :(
How are you sure that 'F' will pass? I was thinking the same, but not sure it will pass or not.
gave the solution above ^^
wait, that isnt the intended solutions? we could have up to log2(1e6) numbers that we need to multiply and divide with so that's at most 20 numbers and we can do bitmask dp on that? Is this not the solution?
but sum of x is upto 10^8 over all test cases.. it won't pass, also, i don't think there is any solution for SOS DP, if try that way, it will become set-covering problem, which is NP HARD. (though i am not so sure.)
F is basically https://cses.fi/problemset/task/1653 but instead of addition, it's multiplication
Similar but not same, cses task is bin pack dp but this is not and apparently it's simpler (refer to lgms codes)
It's getting TLE. 321551502
I can see three 'greedy' tags on 2114C - Need More Arrays's tags lol
Thanks, the problems were really fun!!
First rated contest.. Solved A and C but didn't pass test case 2 in problem B. Waiting for the tutorials..
Maximum amount of good pairs we can make is cnt_zeros/2 + cnt_ones/2. This should make sense.
Minimum amount of good pairs we can make is abs(cnt_zeros — cnt_ones)/2. Why? Every bad pair is a 1 and a 0, so if cnt_ones > cnt_zeros, we will have cnt_ones-cnt_zeros left over, and we will have cnt_ones/2 good pairs.
So, if k < minimum or k > maximum, the answer is NO.
But, not all numbers of good pairs in [minimum, maximum] are possible. If we have the maximum amount of good pairs, we can only reduce it by multiples of 2. Why?
To eliminate a good pair (say, two zeros), we need to find another good pair (of two ones) so the two zeros and two ones can be matched up. So, we can only eliminate good pairs 2 at a time, minimum and maximum always have the same parity.
So, we need minimum <= k && k <= maximum && (k%2) == (maximum%2).
Guys how MyBrainGotTLE able to hack codes so easily and fast of div 3 contests
problem C had weak tests :)
The only way to get >1.5s and not get hacked is by using seg tree
At this rate, so many people will get FST-ed :))
can you hack me too? i have used
std::upper_boundI can't hack you :)
The O(n) solution is hackable ?
nah, bro will drop your points, hack is kind of risky because for one unsuccessful hack your points will drop, and chance of rating drop will increase.
Hacks are unrated in Div.3, Div.4 and Educational Div 2. Rounds.
It is not O(n)
The hacked solutions contain vector.erase() which runs in O(n) so I create a test that runs the vector.erase() n times resulting in a time complexity of O(n^2) which will give TLE with large N
So, I just sort the submissions in descending execution time and go through all submissions from 1.7s to 1.9s and see which one contains v.erase()
The test I used for the hacks were:
1
200000
1 1 1 1 ..... 1 1 1
Hello! Thanks for the nice contest, I really liked the problems.
Anyways, I was wondering if somebody could hack my solution for problem F cause I figure it's just of the verge of not passing due to TLE: 321498835
Hi, your solution and mine (at the contest) are similar. It was some modify from adding to multiplying from a classic dynamic programming bitmask problem (minimum rides for lift) in the very popular book, competitive programming handbook. I pretty confidence that I will not be the only one using this solution alone :D. Sadly, this solution is not fast enough due to the sum of $$$N$$$ can reach $$$10^8$$$. Log constant will not let it pass.
Yep, a friend of mine hacked my solution, altho in general I think that if the time limit was like 4s instead of 3s it might have just passed. But yeah, all in all it was very stupid of me just to accept that solution even though I knew it was wayyy too janky.
if you do the same bin packing DP but with the multiplicity optimization it will very comfortably pass. see 321709533
Hey there! I saw quite a few comments regarding the solution for F... infact I was also pinged here.
I had a different solution:
Firstly, note that for going from x->y it is equivalent to go from x->gcd and gcd->y Which is further equivalent to go from gcd -> x and from gcd -> y and thus from 1->x/gcd, 1->y/gcd
Now I will process the testcases offline. I go in increasing order of k. And a dp solution suffices, because the answer for a given number changes iff it is a multiple of k
Reading the code will give a better understanding Code : 321493342
Hope I was able to explain well and that this solution gave you a clearer understanding. But if you still have any doubts, do feel free to ask them!
Really based solution, learned and thanks.
can someone tell how to achieve y = 982800, x = 1 for k = 13 in just 6 ops. in problem F
13, 7, 2*5, 2*5, 2*2*3, 3*3
$$$982800 = 2^4 * 3^3 * 5^2 * 7 * 13$$$
We can do 6 different divisions in any order. Following are them
$$$ 13, 7, 5 * 2, 5 * 2, 3^2, 3 * 2^2 $$$
I was going through submissions to hack, and I received this warning:
"Recently, your account was used to crawl. Please change your password to prevent your account from being used for unauthorized activities."
I can't view submissions anymore. Is there a way I can get this permission back?
Got stuck on F :(
What is the indeed solution to F, i got hardstuck for so long.
There are a lot of variants, but most stem from the fact that it's optimal to go from $$$x$$$ to $$$\text{gcd}(x, y)$$$ to $$$y$$$. This then involves somehow grouping up the prime divisors of $$$\frac{x}{\text{gcd}(x, y)}$$$ (and vice-versa with $$$\text{gcd}(x, y)$$$ to $$$y$$$, as, due to the available operations, it's symmetric) into groups such that the internal product of each formed group $$$\leq k$$$. Thus, what we end up trying to minimize is the number of such groups.
I couldn't find a trivial way to do this, and one of the reasons why this packing problem isn't as straightforward is because of cases such as the following:
$$$a = [2, 2, 2, 5, 5, 5],\, k = 10$$$
(In this case, $$$a$$$ is the multiset of prime factors that compose $$$\frac{x}{\text{gcd}(x, y)}$$$). In this case, using a very greedy approach you'd get the following groups:
$$$ [ (2, 2, 2), (5), (5), (5) ] $$$
with a cardinality of 4. This is not optimal, as $$$ [ (2, 5), (2, 5), (2, 5) ] $$$ has a lower cardinality. Anyways, after trying a different greedy approach and failing miserably, I figured that some kind dp idea would work. The most obvious being bin-packing dp (see CSES dynamic programming section). However, I believe this is by far one of the slower approaches.
This is slow indeed. I tried this and it gave me TLE. 321551502
Well, my approach didn't give me TLE (altho fyi it was just hacked), but that was probably due to language difference.
How do I solve proble? F,are there some similar problems of the same type?
Check Elevator Rides on CSES
Can someone tell me what is wrong with my solution to Problem E?
I am not sure if bfs would work
bfs would indeed work since you only go to a node after calculating min and max values for it's parent node
submission link -> 321558574
you're using int use long long since node values can be upto 1e9
Video editorial I made for D and E in case anyone is interested (will upload A-C later if I am motivated enough):
Problem D
Problem E
Is $$$F$$$ SOS DP ?
What's the idea behind G? Would appreciate some hints.
Basically, it's a matter of "what´s the maximum number of values I can use to create a value $$$v$$$ in the array?"
Well, let's look at 8: ok, we could put 4 then 2 then 1 then 1. This would give us 8: but wait a second, just putting 1 1 1 1 1 1 1 1 would automatically give us 8. This happens because the following transformations occurs:
Ok, could we use the same idea with 9? Well, we'd have to combine two equal values, but since 9 isn't divisible by 2, we can't do it! From this, we get the intuition that the answer (for each position) is related to how many times we can split the number $$$a_i$$$ into equal parts.
Also, notice that the general construction that we have used basically implies that if for a certain value I have to use at least $$$l_i$$$ and at most $$$r_i$$$ operations to create it, then all the values in between should also be possible.
There are a number of edge cases, but this is the main intuition. Hope this helps!
Yeah, I was thinking along the same lines, and I tried to code it out. But I got wa on tc4. It seems like I am not handling the case properly when two adjacent indices have same bases (base is that number which we eventually get from equal parts division).
In that case, if I am adding on the front/left, and let's say $$$a_{i-1}$$$ is greater than $$$a_i$$$, then what I assume is that I'll add $$$a_i$$$ from the base, and then I'll start from $$$a_i \times 2$$$ and add equal parts until it becomes $$$a_{i-1}$$$. Is my thinking on track?
Well, I think the easier way to understand it would be by looking at the following case: let's say we have already set a 16 as $$$a_{i - 1}$$$ and we're not allowed to change it. Then, suppose the next position $$$a_i$$$ has to be 64. In this case, what happens is that we can't use the following pattern: $$$gen(64) = gen(32) + gen(16) + gen(8) + gen(4) + gen(2) + gen(1) + gen(1)$$$ (where $$$gen$$$ is the operation that generates the given value through some number of recursive calls). Specifically, we can't generate the 32 as our leftmost position because generating 32 involves generating 16 and 16, placing a 16 next to our previous 16 would mess it up (notice that reordering the generators wouldn't help). Thus, we just have to place a 32 there. So, it's equivalent to doing $$$r_i := r_i - gen(32) + 1$$$. Does that reasoning make sense?
Yeah, this is more optimal. I was just adding $$$32, 32, 64, 128...$$$ and so on. I didn't realize we can just put a $$$32$$$ first to prevent merging with $$$16$$$, and then just continue with our $$$gen(32), gen(64), gen(128)...$$$ and so on.
difficulty estimations
A — 800
B- 900
C — 900
D — 1300
E — 1500
F — 1900
G — 2200
For me E was easier than D. E was kind of standard, but D required a bit of thinking. Also, G and F were pretty close.
listed difficulty:
A: 800
B: 900
C: 1000
D: 1400
E: 1400
F: 2000
G: 2200
you were pretty accurate
is it just me or was this div3 pretty easy? i managed to solve till E in an hour. cant get rid of the TLE on F tho ~
well, i don't really know about others, but the problem D cooked me hard
at the start i made a small typo, which i found after half an hour
I learned the hard way that Python sucks at recursion. I got runtime error doing DFS in E. Had to do it iteratively.
https://codeforces.me/contest/2114/problem/E I want to ask in 2114E - Кирей атакует поместье how will we proceed if they ask us about any alternating path starting from that vertices like the path is not necessary to be retracted to parents everytime
Then the problem gets complicated.
Hey I am new to contests in general, will I receive rating? I solved 1 question in this round. Is this Div 3 unrated?
yes you will get rating if you participated rating, in div 3 after the hacking phase is over in which people challenge each other's solutions, a system testing will be there after which you will get you rating.
can someone hint simulation proof of problem B
thanks in advance
Since we need to have k good pairs, we need to have
(n/2 - k)0's and 1's. Remove those and check if the remaining 0's and 1's are even or not.The questions were very interesting and I enjoyed the competition. My favorite question was D.
Guys first my program of question D was accepted and now in system testing it is showing TLE it is not fair
Haven't you read the announcement?? It clearly said that:
After open hacks all accepted solutions will be rejudged on successful hacks.
So you got TLE by someone's successful hacking test (I swear it wasn't me, I only hack ppl on A and C)
oh so my code is hacked :(
Not necessarily, think of it this way:
When a person A successfully hacks person B with test C, that person A cannot hack 10k people in 12 hours because it is too much, right?
So Codeforces makes a system to rejudge the submissions using the test C that person A hacked, and your code got TLE by that test
just it won't give negative of -100
I don't think you understand how hacking works in div 3/4 rounds.
In div 3/4 rounds, when you are hacked, your problem count and penalty just decreases, not your score.
In fact, there isn't even a score in div 3/4 rounds, rankings are made by penalty and problem count
I solved 3 questions but now it shows I've solved only 1. Also my rating hasn't changed. Someone please help me understand what happened. Could it have been hacked? If yes then where do I check it? Thank You! :)
It is still in the system testing phase.
The testing system grades your submissions in chronological order, which means the later you submit, the later you will get your results. So when you have solved 3 problems and it only shows 1, it means that the system is still grading your submissions on your other 2 problems
After a few hours after system testing, your rating will change
Hi everyone, I participated in Codeforces Round 1027 (Div. 3) with username VSS303311_Ashalina. I solved 4 problems, and the contest was rated for me. My previous rating was 556, but I didn’t receive any rating update after the contest. Could you please check if there was any issue? plz reply me_
It's still updating, I haven't received the rating yet too
Oh tysm for telling me, I was actually scared. Has no one received it yet?
cheater
In problem F , is not the best option to try to divide a number by it greatest divisor that is less or equal than k , i tried it but it didnt work .
No, it isn't.
Did you get the rating?
It will be updated later.
It is still approximately 1-2 hours until rating changes
What is up with the judge? My 321615531 is in queue for last 10 minutes.
Hi Guys, I am solving problem F in yesterdays contest. Here is my approach for x, y k:
1. do prime factorization for x, yif (x*(mul)/(div)) = y, the from above step, we can get prime factorization of mul,div. i.e. x = 20, y = 15, then x's prime factorization: = [2,2,5], y's prime factorization: = [3,5], mul: =[3], div: = [2,2]
now reduce the size of mul and div. i.e. if any elements product is less than k, then remove them by replacing them with their product. make sure size of arr is as small as possible.
final ans is sum of size of mul and div.
I am getting TLE with step 3. I used subsets dp approach as in https://cses.fi/problemset/task/1653 Could you please help me with this. my submission: https://codeforces.me/contest/2114/submission/321619523
I think you are using a greedy approach, which doesn't work. You can try for example with the last but one test case, if you take any elements to replace them with their product, you can end having more steps than the solution. I don't know why you are getting TLE, it should be WA.
Let's go for worst case, say no. is 10^6 approximated to 2^20, giving factors up to 20 and it would cost us a O(x*2^x) = 20 * 2^20 which is fine, but we do dp mask twice and also we have 10000 test cases, implying our T.C shoots over 1e9. This would fail. Even I did same and got TLE coz I didn't calculated this earlier and recalled that factors till 20 should be k, but that was for just 1 testcase.
i believe if you instead do this DP with the optimization of not counting duplicate combinations (as prime factorizations are high in multiplicity), you get a much better bound...
instead of up to 19 (some duplicated) factors,
you have up to 9 distinct factors (
prod(range(2,11)) > 1e6), (each with an associated count, where the total counts still does not exceed 19).This greatly reduces the worst case from $$$2^{19} \simeq 5 \times 10^5$$$ to (i think) $$$240$$$ in the case of 720720: $$$720720 = 2^4 \times 3^2 \times 5^1 \times 7^1 \times 11^1 \times 13^1$$$
note that $$$(4+1)(2+1)(1+1)(1+1)(1+1)(1+1) = 5 \times 3 \times 2 \times 2 \times 2 \times 2 = 240$$$ distinct subsets, where in general the number of distinct subsets of a multiset is
prod(cnt + 1 for cnt in set.counts())edit: i realize we're actually just counting the number of divisors here
I am confused after reading your comment, can you summarize your comment, that would be helpful.
basically, the DP solution can be optimized by NOT iterating over subsets that have different bitmasks but are otherwise identical (which happens when the set contains duplicates, like the prime factorization of a number)
you could see 321709533
how much more time before editorial comes in?
Can Someone please tell how to optimize my E 321650903
I think this alone has complexity $$$O(N^2)$$$, by creating a vector of size
n— n times:I didn't quite understand what function
recursedo but it seems it has linear complexity, let alone the map which adds another $$$log$$$ factor. Regardless, think of another approach with better complexity and doesn't dodfs-similarfor each node.One of the best G I have seen in a div3.
the fate reference on E lol
My first time solving 6 problems in Div. 3
I love this contest:)
I just used topological sorting and then traversing each vertex in that order , it was basically just using the all known graph algorithms.
@Vladosiya @myav @Gornak40 @KwisatzCoderach
I received a Mail today from Codeforces stating that my Solution to D (Submission ID : 321481547) in Codeforces Round 1027 matched with quite a many other users. Note here, that the question D was an easy question having a simple straight-forward approach and having the similar logic for D is not at all difficult.
The match that has occurred, I believe, is purely co-incidental because I have not used any public IDE, neither have I resorted to cheating from Pirated Sources. Also note that, I have not shared my code to anybody. I have appeared for the contest and solved the questions in legal manners.
I request you earnestly to kindly look into the matter.
Dear Codeforces Team,
I received a warning that my solution 321490662 for Problem 2114E significantly coincides with another participant’s code. I want to clarify that I did not intentionally share or copy code.
It’s possible that my code was unintentionally leaked — I may have discussed logic with someone casually without realizing our final implementations would end up this similar.
I understand that even unintentional sharing is considered a violation. I sincerely apologize and assure you that I will be more cautious in the future to avoid such issues. I respectfully request that my situation be reviewed, and I am willing to accept a penalty if required.
Thank you for maintaining the integrity of the platform.
This is a standard DFS + DP on trees template that I’ve learned through previous practice, tutorial blogs (like cp-algorithms), and contests. The transformation formulas (max(a[v], a[v] — smin[parent])) follow logically from trying to maximize gain by optionally subtracting parent paths. I wrote the code myself during the contest based on my understanding. Someone else might have use the same source as well
I want to clarify that I did not copy any code from another participant. I wrote my solution independently before my friend. I can provide evidence, such as timestamps or version history, to confirm that my version was created first. I fully understand and respect the competition rules and would never engage in dishonest practices. Any similarities between our submissions are due to the fact that we use the same template. I would request the admin to include my rating for this contest
Hi Codeforces Team, I recently got a message saying my submission (321467772) for problem 2114F was flagged for being similar to someone else’s. I just wanted to clarify that I only use this account (The_Sambhav) and I wrote the solution completely on my own during the contest. The method I used was building a graph of divisors and doing BFS to reach the target number which is something I learned from common tutorials. The idea of checking if all prime factors are within a certain range also came from standard number theory problems. I didn’t share my code with anyone or work with anyone else, but I now realize that since this approach is quite standard, maybe someone else used the same method, which led to the similarity. Just for reference, here are some of the resources I studied these techniques from: GeeksforGeeks – BFS in Graphs, GeeksforGeeks – Finding All Divisors, CP-Algorithms – BFS, CP-Algorithms – Primality Tests, Errichto’s YouTube Playlist I respect the rules of the platform. I’ll be more careful going forward to make sure there’s no accidental overlap like this again. I hope you can review the case again and consider not penalizing my account. Thanks a lot for your time and for running such a great platform.
-The_Sambhav
hii
Dear Codeforces team,
I recently received a plagiarism notice concerning my submission for Problem 2114D in the recent Div. 3 contest (Submission ID: 321441614). The notice indicates a significant similarity with another user's submission (User: nortox_2144, Submission ID: 321486683).
I would like to clarify that I participated in unrated mode and submitted only this one problem before leaving due to personal commitments. The other user's submission was made over an hour later, and it appears all their submissions have been skipped.
I suspect the similarity may be due to using a public online compiler, as I'm currently facing issues updating my local C++ compiler beyond version C++11.
I assure you that I did not engage in any dishonest activity and take the Codeforces rules seriously. I kindly request a review of this issue or guidance on how to proceed.
While I cant bring any evidence that this was just a coincidence.
I can see how both submissions are very similar to mine 321494024 , 321453033
so kinda interesting I guess.
it is a good opportunity to start recording me doing contests again.
Hello Codeforces Team,
I have received a message regarding a similarity between my solution to Question F of this contest and that of another participant. I would like to clarify that I have neither cheated nor shared my code with anyone. I solved the problem entirely on my own and it is just a coincidence.
However, I would like to point out that a similar question — involving interchanging numbers through division and multiplication — was previously asked in a contest hosted by the Coding Club of my college. Link to the contest's questions. It was Question 1 in that contest, and its solution had been discussed at the time. Therefore, it is possible that my solution resembles others due to that prior exposure.
That said, I cannot view the other participant's submission and hence cannot comment on it. But I am confident that I have not engaged in any form of malpractice or cheating, which I understand is strictly against the contest regulations.
Moreover, the structure of my solution to this problem is consistent with my other submissions, which can be verified. I respectfully request the admin to review this conclusive explanation and the provided evidence and kindly remove the allegation from my account.
Thank you.
Hi Codeforces Team,
I received a message concerning plagiarism for problem 2114D of this contest on my submission 321509477 with user P1KACHUUU for their submission 321458826.
I completely understand that plagiarism and colluding is against the codeforces guidelines; however, I believe the similarity between our code is completely by coincidence. I developed my solution approach by considering that it would be optimal to remove the point that is at the smallest or largest x-y positions. I then considered the cases where the smallest / largest x and y are the same point and adjusted for that. Finally, I considered the case where the remaining area is equal to n — 1, in which case we must add the removed point back to the shortest side.
Although our code is very similar, I think it is reasonable for two random contestants to have the same intuition regarding this problem and implement our solutions in the same manner. Looking at other solutions for 2114D, if participants only consider using arrays rather than multi-sets or other ordered data structures to find the remaining max and min, their solutions would be very similar to mine and P1KACHUUU's. Secondly, our code differs in the fact that to create a list of points sorted by the y values, P1KACHUUU uses a list with points stored as {y, x} along with the list of points stored as {x, y}. On the other hand, my solution creates two lists, but stores both as {x, y} points and simply uses a custom comparator to sort the second list into non-descending order by y-value. This slight difference causes distinct problems for sharing code as it requires the re-ordering of every line involving the second list of points sorted by y-values.
I also think that considering P1KACHUUU is over 1600 rated and was thus not able to compete as a rated participant in a Div 3, it is highly unlikely that they decided to collude and submit plagiarized code. I did not plagiarize, and I believe that neither did P1KACHUUU. Although I can only claim that our code is similar due to random coincidence, I do not believe that this similarity is completely improbable.
Please look into this, and thank you for your time.
-Andelupe
Hello Gornak40, KwisatzCoderach, Vladosiya, myav, and Codeforces team,
I received a notification that my solution 321514179 for problem 2114D coincides with others. I want to clarify that my solution uses a common and standard approach with prefix and suffix arrays to compute min/max values, which is widely known in competitive programming.
Though the approach is common, I implemented it using a custom struct point that others didn’t use, and my variable names and function structure are different.
My solution was developed independently, based on these well-documented methods (e.g., Codeforces blog: https://codeforces.me/blog/entry/133828, GeeksforGeeks article: https://www.geeksforgeeks.org/prefix-sum-array-implementation-applications-competitive-programming/).
Thank you for your understanding. I’m happy to provide further details if needed. "I only used CodeChef's online IDE to write my code, and I never shared the link or the code with anyone. I believe this must have been an unintentional coincidence or an unauthorized copy."
– ashok4
Hello, I recently received a notification stating that my solution (ID: 321479165) for problem 2114D coincides significantly with another user’s solution (Slumio/321472983). I would like to clarify that I do not know this user and did not share my code with anyone. This was purely a coincidence. The only similarity between our solutions is the use of prefix and suffix arrays, which is a common idea in competitive programming. The idea is also available prior to the contest on the website: https://www.geeksforgeeks.org/precomputation-techniques-for-competitive-programming/. I implemented my solution independently using these well-established strategies. I kindly request the moderators and the head of Codeforces, Mike Mirzayanov, to carefully consider this explanation and remove the allegations against me. Thank you very much for your understanding and support.
– charanteja001
Subject: Clarification Regarding Submission Coincidence in Problem 2114D (Submission ID: 321472983)
Dear Codeforces Team,
I would like to firmly state that I have not engaged in any form of cheating or rule violation during the contest in which I submitted solution 321472983 for Problem 2114D.
I do not know the users charanteja001, and I have never communicated or shared any code with them. My submission was made before the other mentioned users, which is clearly visible in the submission timestamps. I fully understand and respect the rules of Codeforces and competitive programming ethics, and I take them very seriously. I am ready to provide any additional clarification or information that might help in resolving this issue fairly.
Hi All, I recently received a message that my code significantly matches with another person whom I don't even know (https://codeforces.me/contest/2114/submission/321530468).
I would like to clarify that my submission was made much earlier than the concerned person and I have not shared my code to anyone and have written the code in my own VS Code. My code involves a basic BFS traversal using queue using visited array. I dont know how I got flagged even though I have not copied from anyone or anywhere. I would request to reconsider my code and my contest submissions are not skipped.
Thanks!