Introduction
Contest #2 was an exciting competition with strong participation from multiple contestants. The contest featured four problems (A, B, C, D), and the results were as follows:
lilpluton was the first to solve A.
__baozii__ was the first to solve B.
AkbarKING was the first to solve C.
MR_NoSolution was the first to solve D.
The fastest full completion was achieved by __baozii__ (88 minutes).
Standings
| Rank | User | Solved | Penalty |
|---|---|---|---|
| 1 | __baozii__ | 4 | 88 |
| 2 | AkbarKING | 4 | 89 |
| 3 | TripleMO | 4 | 120 |
| 4 | MR_NoSolution | 4 | 150 |
| 5 | gholyo | 4 | 204 |
| 6 | ammahmed004 | 4 | 342 |
| 7 | Mostafa_Alaa99 | 3 | 37 |
| 8 | MMO | 3 | 54 |
| 9 | ibluefox | 3 | 85 |
| 10 | abrakadbra | 3 | 86 |
Join our group to participate in future contests and discussions: Codeforces group and Telegram group
Problem A:
Author: Mohamed_Shosha
Tutorial
Code
Problem B:
Author: X_SeL1M
Hint
Solution
Code
Problem C:
Author: X_SeL1M
Tutorial
Code
Problem D:
Author: X_SeL1M
Tutorial
Code








Finally ^__^ Thanks for the great contest :) Last one was a completely new idea and topic for me
Thanks for the authors <3 but I think the last contest was better because it had various topics not only one topic like this contest (I read ABC and all of them were math based) and the statement was somehow not understandable :(
THanks again for the big effort from the authors and testers.
why in problem A i can't compare the Distances directly?
Because their values by itself will not give us an exact answer
for example consider X = 5 and S = 4
for n = 5
X will win S and comparing X with S will give us the same result
but for n = 4
it is a TIE, but comparing X with S will tell us that the result is X should win which is wrong
but let's see when we divide and ceil and see what will happen
for n = 4
Xscore is ceil(4 / 5) which is 1
Sscore is ceil( 4 / 4) which is 1
It is a TIE and comparing Xscore with Sscore will also tell us TIE as both are ones
for n = 5
Xscore is ceil(5 / 5) which is 1
Sscore is ceil(5 / 4) which is 2
so here it is X wins and comparing the result 1 < 2 then also our comparison will work
so this is one case where comparing X and S themselves will fail and we should compare Xscore and Sscore which are ceil(n/X) and ceil(n/S) which means how many steps will take each of them to reach n is more accurate to handle (or any other case) the case where both are sufficient to reach n in the same time even one of them is higher than the other as in the case n = 4, X=5 and S=4 both were sufficient to reach to n in the same time (one step)
I understand now, thank you for your effort.