Ormlis's blog

By Ormlis, history, 4 months ago, translation,

Hi everybody,

This Sunday there will be a XX Moscow Team Olympiad, high school students competition based in Moscow that is an elimination contest for All-Russian Team Olympiad. This contest is prepared by Moscow Olympiad Scientific Committee that you may know by Moscow Open Olympiad, Moscow Olympiad for Young Students and Metropolises Olympiad (rounds 327, 342, 345, 376, 401, 433, 441, 466, 469, 507, 516, 541, 545, 567, 583, 594, 622, 626, 657, 680, 704, 707, 727, 751, 775, 802).

The round will be held at Oct/23/2022 10:50 (Moscow time) and will last for 2 hours. Note the unusual time of the round. Each division will have 6 problems. The round will be held according to the Codeforces rules and will be rated for both divisions.

Problems of this competition were prepared by Tikhon228, teraqqq, Ormlis, sevlll777, Artyom123, vaaven, Mangooste, Siberian, Alexdat2000, TeaTime, Ziware guided by Tikhon228, grphil and Helen Andreeva.

Thanks to DishonoredRighteous and KAN for the round coordination, statement translation, providing and preparation additional problems, and also thanks for MikeMirzayanov for systems Codeforces and Polygon, which was used to prepare problems of this olympiad.

Also thanks to KLPP and TheOneYouWant for providing and preparation an additional problems that helped to create (I hope) a balanced problem set for the round.

Please note that the ratings will not be recalculated until Codeforces Round #830 (Div. 2), and system testing may be delayed until the end of Codeforces Round #830 (Div. 2).

Good luck everybody!

UPD1: The round was postponed by 15 minutes. Please note the new start time is Oct/23/2022 10:50 (Moscow time).

UPD2: Great thanks to the testers: Um_nik, dorijanlendvaj, errorgorn, vertig1, Makcum888, iakovlev.zakhar, Kon567889, I_love_geom, golikovnik, mejiamejia, Aleks5d, ak2006, jampm, IgorI! As well as the teams testing the main Olympiad: Elderly Passion Fruit (Siberian, alexxela12345, talant) and (maximrufed, omega_alpha, All1gator).

UPD3: Scoring distribution:

Div.2: 500 — 1000 — (750 — 750) — 1250 — 2000 — 2250

Div.1: (500 — 500) — 750 — 1750 — 2000 — 2500 — 3000

UPD4: Winners!

Div. 1:

Div. 2:

UPD5: Editorial

• +520

 » 4 months ago, # | ← Rev. 2 →   +30 As a contestant, good luck everyone. Hoping for a great and balanced round :)
 » 4 months ago, # |   -40 I'm actually curious, if a newbie somehow AKs both rounds on the day, will it be a world record on shortest time to get to Expert/CM/Master?
 » 4 months ago, # |   +1 Second Last line hurts me :cried:
 » 4 months ago, # |   -34 So early in the US :(
 » 4 months ago, # |   -99
 » 4 months ago, # |   +160 This contest contains one of my favourite problems I've written, so please participate! :)
•  » » 4 months ago, # ^ |   +5 Sure, will do
 » 4 months ago, # | ← Rev. 2 →   -34 Hopeful to participate.
 » 4 months ago, # |   +9 Hoping That Both 829 and 830 will be my best round ever . And I am able to find my Codeforces profile in green :)
 » 4 months ago, # | ← Rev. 2 →   +10 I am looking forward to the problems of this contest, hoping to surprise me.
 » 4 months ago, # |   +17 "and system testing may be delayed until the end of Codeforces Round #830 (Div. 2)."Imagine doing two contests in a row only to find out you FST'd in both, at the same time
 » 4 months ago, # |   +6 Please note that this contest doesn't start at a usual time. And there is also a contest (#830) on the same day. (As I said in #830)
 » 4 months ago, # |   0 How will Codeforces decide whether or not someone should be rated after round #830? Does it depend on their rating just before #830 begins or after #829 gets rated?
 » 4 months ago, # |   +41 I feel bad for who will participate in this round then get a negative delta and participate in the second one to cover the loss then get also a negative delta
•  » » 4 months ago, # ^ |   +21 well,
•  » » 3 months ago, # ^ |   +1 I hope this doesn't happen to me.
•  » » 3 months ago, # ^ |   +5 Why are you talking about me Sir!
 » 4 months ago, # |   -25 Unusual timing. I hope this round will not be speedforces in 2 or 3 problems like Educationals.
•  » » 4 months ago, # ^ |   -7 I think 4th on last round were perfectly solvable
 » 4 months ago, # |   0 Spoilerit is pupil time
•  » » 4 months ago, # ^ |   +6 Best of Luck
 » 4 months ago, # |   +148 Thanks for preparing for the contest and I'm very interested for the contest.　By the way, couldn't it have announced a little earlier? If I remember correctly, this contest's schedule was added to the calender three days ago. As div1 contests are not abundant, I try to adjust my schedules as much as possible since the date has been added. Actually, three days ago is too late to make adjustments. Ofcourse I understand there are several reasons why you can't give us notice, but can it be a little quicker? As div1 contests are valuable, we contestants want to participate in as many as possible.
•  » » 4 months ago, # ^ |   +83 We are very sorry for this. I hope you enjoy the contest =)
•  » » 3 months ago, # ^ |   0 I got the news earlier than you, and I knew it before codeforces didn't show the competition on the page. Personally, I feel that it is really necessary to inform the players of the contest time in advance, but there are always some uncertain factors interfering, and I can only hope that these factors play as little role as possible.
 » 4 months ago, # |   0 Hope to get clear and precise problem statement with strong pretests.
 » 3 months ago, # |   0 As a contestant, I would you and myself good luck and hope I won't lose too much!
 » 3 months ago, # |   0 just imagine skipping college tomorrow and getting negative a delta in both rounds
 » 3 months ago, # |   +45 Give me downvotes for spending 5 nights for developing my problem. I deserve it.
•  » » 3 months ago, # ^ | ← Rev. 2 →   -13 ……
 » 3 months ago, # |   +10 I'm ready! Good luck to all the contestants
•  » » 3 months ago, # ^ |   0 +1
 » 3 months ago, # |   +1 unbelievable to see two contests both with unusual time
 » 3 months ago, # |   +1 I am fortunate to witness two consecutive rounds one after the other both with unusual timings best Sunday ever I hope I can get back to specialist after this two consecutive rounds :) .
 » 3 months ago, # |   0 I'm not familiar with Moscow Team Olympiad, but will it be an ICPC style contest (i.e., all problems having equal value, no hacking during contest, etc)? If so, this should be specified in the post (as well as what the resubmission penalty is, since the Codeforces standard of 10 minutes is not universal). If not, the score distribution should be posted, or at least a note that it will be posted later (but there is less than an hour before the contest starts...)
•  » » 3 months ago, # ^ |   +3 It's based on ICPC-style contest (Moscow Team Olympiad), but codeforces contest will be normal.
 » 3 months ago, # |   0 What does (750-750) in div.2 means?
•  » » 3 months ago, # ^ |   0 C no problem will be divided into 2 subproblems C1 and C2. Both have 750 points.
 » 3 months ago, # |   0 Why tourist is not participating ??
•  » » 3 months ago, # ^ |   +1 Stop stalking him.
 » 3 months ago, # |   0 is this round delayed 15 minutes?
•  » » 3 months ago, # ^ |   0 yes, it will start after 20 minutes
•  » » » 3 months ago, # ^ |   0 Thanks bro
 » 3 months ago, # |   0 good luck guys!
 » 3 months ago, # |   0 This is my second time to participate. It's exciting, but I hope the results are the same……
 » 3 months ago, # |   +80 Speedforces is trash.
 » 3 months ago, # |   +32 How in the world >3000 people solved D1B/D2D /:
•  » » 3 months ago, # ^ |   0 How to solve Div2D T_T
•  » » 3 months ago, # ^ |   +44 Problems like those make me question my existence.
•  » » » 3 months ago, # ^ |   +12 what a noob
•  » » » » 3 months ago, # ^ |   0 :((
 » 3 months ago, # |   0 how to do C1?
•  » » 3 months ago, # ^ |   0 You have no zeros so each value change parity of sum regardless of partition. So if $n\ mod \ 2 \ne 0$ then answer is $-1$. Then you can split array in subarrays of length of $2$. Than you have cases: $1,1$ -- thar array gives zero; $-1,-1$ --that array gives zero; $1,-1$ -- you can split in two arrays of length $1$ sum would be zero; $-1,1$ -- you can split in two arrays of length $1$ sum would be zero; So you got correct partition.C2 can be got by sligtly modification to this, but I spent 1.5 hours to try write this out :((.
•  » » » 3 months ago, # ^ |   0 C2 is like C1 but it adds +4 cases in your solution which depends on parity of zeros between ones and also you need consider zeros between pairs of ones, the first one and the last one.
 » 3 months ago, # |   +14 How to solve E?
•  » » 3 months ago, # ^ | ← Rev. 5 →   +45 End goal = get $K$ $1$s towards the end of the array, where $K$ is the count of $1$s in the initial array. Say in the current state, there are $R$ $0$s in the last $K$ positions. (end goal is to get $R$ down to $0$)This number $R$ can only decrease or stay the same with operations.Let $f(R)$ be the expected number of turns to go from $R$ $0$s to $R - 1$ $0$s. Since our end goal is to get to $R = 0$, i.e no $0$s in the last $K$ positions, we want to find $f(R) + f(R - 1) + ... f(1).$ $(R \rightarrow R - 1 \rightarrow R - 2 .... 1 \rightarrow 0)$.Note that $R =$ #$0$ in the last $K$ positions = # of $1s$ in the first $N - K$ positions. So probability that we go from $R$ to $R - 1$ in one turn is $p(R) = \frac{R^2}{nC2}$. i.e we need to pick a $1$ from $R$ $1$s in the left $N - K$, and a $0$ from $R$ $0$s in the right $K$. That makes $f(R) = \frac{1}{p(R)}$Answer is sum of $f(r)$ for $r$ in $[1, R]$ i.e sum of $\frac{nC2}{r^2}$ for $r$ in $[1, R]$.
•  » » » 2 months ago, # ^ | ← Rev. 2 →   0 can anyone explain Why $f(R)=1/p(R)$ ? sinus_070
•  » » » » 2 months ago, # ^ | ← Rev. 2 →   +1 If an event occurs on a try with probability $p$, the expected number of tries to achieve that event is $1 / p$.Exp trials = $S = 1 * p + 2 * (1 - p) * p + .. i * (1 - p)^(i - 1) * p$$S - (1 - p) S = p + (1 - p) .p + (1 - p)^2 .p + ...$$p . S = p . (1 / (1 - (1 - p)))$$S = 1 / p$Roughly if probability of an event is p = 0.2, we say it happens 1 out of 5 times. For a general p, it's expected to happen once every 1 / p times.
•  » » » » » 2 months ago, # ^ |   0 Thank you <3
 » 3 months ago, # |   +2 I am too dumb to solve A. I think B, C1, C2, D are even easier than A.Would you please review my code: https://codeforces.com/contest/1754/submission/177553775? I stuck at A for 30 minutes but ended up failing to solve it.
•  » » 3 months ago, # ^ |   0 same I could have been submitted C2 also but damnn this A suckssss
•  » » 3 months ago, # ^ |   -8 same not able to solve A
•  » » » 3 months ago, # ^ |   0 brother i stucked with B problemint t; cin>>t; for(int i=1;i<=t;i++) int n; cin>>n; int k=n/2; int s=1; for(int i=k+1;i<=n;i++) cout<
•  » » » » 3 months ago, # ^ |   0 the question is that we have to find such a permutation whose minimum absolute difference of all consecutive elements is maximum . we can observe that this value is n/2 .for implementation you can refer this 177548133
•  » » » » » 3 months ago, # ^ | ← Rev. 2 →   0 thanks brother,i appreciated btw your progress was super have any suggestion for this newbie?
•  » » » » » » 3 months ago, # ^ |   0 regular practice !!
•  » » 3 months ago, # ^ | ← Rev. 2 →   +6 I didn't properly review your code, but I skimmed over it, and you seem to be focused on the chain length for the Qs, which I don't think should be important. Here is a failing test: 1 9 QQAQQQAAA Answer should be No, because there are five questions and only four answers.I'm not sure exactly what your approach is, but you might be overthinking this. Here is a hint for a much simpler solution: maintain a count for the number of unanswered questions while you read the characters. This count cannot be negative. My solution: 177536462
 » 3 months ago, # |   +4 I first-solved on Problem C1, and I got -100 rating XD
 » 3 months ago, # |   0 Please someone tell me how did you solve D ?? Could solve A,B,C1&C2 in the contest but wasn't able to solve D:( Hope that my rating increases by some significant amount
•  » » 3 months ago, # ^ |   +4 Merge small factorial to large factorial:https://codeforces.com/contest/1754/submission/177602806Do not have too much time to explain because the next competition is coming.
 » 3 months ago, # |   0 How to comeup with intution to solve Problem C1 and C2?
 » 3 months ago, # |   +8 Am I missing some very obvious observation on div 2 D? How does it have so many solves?
•  » » 3 months ago, # ^ |   0 What happens when you add 2 factorials? How many x! is needed to make it (x+1)!
•  » » » 3 months ago, # ^ |   0 So just greedy priority queue would work?
•  » » » » 3 months ago, # ^ |   0 D don't need to pq or greedy you just need to count each number and check that the number a has (a+1)if a has (a+1) it can make (a+1)! and you should cnt[a] -= a+1 and cnt[a+1]++.you repeat the operation for all inputed numbers and finally check that in for(i=1 ~ i=x), cnt[i] != 0 is exsited if cnt[i] != 0 is exsited, it can't be divised by x! sorry for bad english
•  » » 3 months ago, # ^ | ← Rev. 2 →   0 assume $a_i$ is the smallest $a_*$ , then $a_i$ must ocurr $k(a_i+1)$ times for the whole sum to be divisible by $(a_i+1)$
•  » » 3 months ago, # ^ |   +6 I believe the submissions on D are justified, as you just need one simple observation.Lets take the first sample test for example 6 4 3 2 2 2 3 3Sum of all factorials of the array will look like: 3! + 2! + 2! + 2! + 3! + 3! This can be further simplified: 3! + 3*(2!) + 3! + 3! Now 3*(2!) is simply 3!. So: 3! + 3! + 3! + 3! Again simplifying: 4*(3!) Which makes it: 4!You can see that this is divisible by 4! :) I will leave the rest little corner cases and observations to you. Good Luck!
•  » » » 3 months ago, # ^ |   0 This is exactly what I did though, but it didn't pass... I made a map to count the number of occurrences of each element, and then iterated from the smallest to the biggest. If element $v$ appears $k$ times, then we can form $k/(v + 1)$ copies of $(v + 1)$ (which we add to the count for $(v + 1)$). After all this, we check the last element of the map (which has a count of at least 1), and see if it's $\geq x$. If so, the answer is YES. Otherwise, the answer is NO. My submission: 177595468I suspect that the failure arises because I did nothing with the leftovers, i.e., the remaining $k \% (v + 1)$ copies of $v$. But I don't see how they would influence the result, and such consideration seems really tricky, so are you sure there isn't a more challenging observation that you aren't mentioning?
•  » » » » 3 months ago, # ^ | ← Rev. 4 →   +3 Yes, you are correct why your solution is failing. I will explain more with an example.7 3 1 1 1 1 1 1 2Note that: 1+1 = 2 = 2!Thus, sum of array becomes: 1. 1! + 1! + 1! + 1! + 1! + 1! + 2! 2. 2! + 2! + 2! + 2! 3. 3*(2!) + 2! 4. 3! + 2!Nice, this is most simplified equation, you can get. And, all that's left is to just check if this is divisible by 3! What do you need to make the sum divisible by 3!? The sum should be a multiple of 3!.Can you take 3! common out of 3!+2!? No. You can atmost take 2! common, which makes 2! * (3 + 1). But, this does'nt help. This is how the left-overs affect the solution. Also note that there can be left-overs which are greater than x. Because you can take 3! common out of 3! + 5! => 3! * (1 + 4*5) Here's my submission 177646415 Hope this helped, and I did not overcomplicate it ;-;
•  » » » » » 3 months ago, # ^ |   0 I figured it out, thanks to your help, and managed to AC 177657032Problem was actually much easier than I initially thought. Thank you so much!
•  » » » » » » 3 months ago, # ^ |   0 Glad it helped!
•  » » » » 3 months ago, # ^ | ← Rev. 5 →   +3 It doesn't matter what the last value of your map is, in fact you don't care about the values >= x (those are already $0 \mod x!$). All that matters is that you shouldn't have any leftovers at all. ProofConsider having the maximum number of leftovers you could, i.e. you have $x$ copies of $x!$, for all $x$ $\sum\limits_{x=1}^{N}{x \cdot x!} < (N+1)!$You can see this by adding $1!$ to $\sum\limits_{x=1}^{N}{x \cdot x!}$, it becomes $(N+1)!$
•  » » 3 months ago, # ^ |   0 Hi, I still don't understand the problem 1753B — Factorial Divisibility. I don't understand the case when there are leftovers, why do we can say that if that happens, it's no divisible by x! ? For example how to know that 3*7! + 4*5! are not divided by 8!?Could someone help me please? Chimpanzee,gupta_samarth,SilverWing05
•  » » » 3 months ago, # ^ |   0 HeyJust take a look at this example, (9! + 8! + 9!) and you want to check if this is divisible by 8!For (9! + 8! + 9!) to be divisible by 8!, (9! + 8! + 9!) should be a multiple of 8!Can you take 8! out of (9! + 8! + 9!)? Yes. 8! * (9 * 1 * 9)Thus, it is divisible by 8!But what if the sum of array was something like this (7! + 8! + 9!)Now, what's the biggest factorial you can take out of (7! + 8! + 9!)? It's 7! So, 7! * (1 + 8 + 8*9)But, this cannot be divided by 8! because we need the factor to be greater than equal to 8!This is why there can be no leftovers less than x.Hope you understood, because this is the best I could do in layman terms)
 » 3 months ago, # | ← Rev. 2 →   0 could anyone review my code in D and tell me the fault!
 » 3 months ago, # |   -25 Do-you-know-calculus-forces
 » 3 months ago, # |   +9 Very amazing contest!Congrats to the authors!
 » 3 months ago, # | ← Rev. 2 →   +19 Sudden death when I noticed that I was wrong about the usage of priority_queue right after the contest(Waiting unlock the contest to resubmit for about 3 hours due to the round #830...)Anyway the problems are good though I make fatal mistakes in the contest. Good job!
 » 3 months ago, # |   0 Is Div1 D related to Kuhn? I thought, that I can start from free cell, and then find increasing chain with minimal cost. However, I died in last sample, when starting from any free cell, I try to do two rotations and one shift.
•  » » 3 months ago, # ^ |   +8 Yes it is related, you are missing the case when you split the augmenting path in two and shift everything in each half to cover the free cell instead of shifting everything along the path ie creating two free cells at the end or the beginning.
 » 3 months ago, # |   +25 I hope Div1 D will be harder next time .
 » 3 months ago, # |   -8 Is the round #830 now rated for me? I will fall to candidate master after this round rating changes come.
 » 3 months ago, # |   0 Can someone show me their implementation for C2? Im pretty sure I figured it out but found the implementation very tricky!
•  » » 3 months ago, # ^ |   0 Based on the C1 code, you can reverse the sign according to the number of leading zeros.
•  » » » 3 months ago, # ^ |   0 Can you please elaborate?
•  » » 3 months ago, # ^ | ← Rev. 4 →   0 First, divide all the non-zeros into pairs. If there is an odd number of non-zero values, then the objective is impossible (output -1).Let's say you have some non-zero value $a$, followed by $k$ 0s (where $k \geq 0$), followed by a non-zero value $b$. If $a \neq b$, then take a partition of $a$ with all the $0$s and a partition of just $b$, so they cancel each other out. Otherwise, if $a == b$, there are two cases: There are no zeros in between (like C1). Then just take a partition of $a$ and $b$ together. There is at least one zero in between. Then take a partition of $a$ with $(k - 1)$ 0s (all but one), and take a partition of just $[0, b]$. Then the sign on $b$ gets flipped and they cancel each other out.
•  » » » 3 months ago, # ^ |   0 What happens if there is some non-zero value a, followed by k zeroes, then some non-zero value b where a != b. Then what happens?
•  » » » » 3 months ago, # ^ |   0 That was the first case I mentioned. Take a partition of $a$ with all the 0s and just $b$. For example: 5 1 0 0 0 -1 One of the correct answers would be: 2 1 4 5 5 
•  » » » » » 3 months ago, # ^ |   +3 Yes i understand now, thanks.
 » 3 months ago, # |   +43 Hacked a solution for 1B with fixed-module hashing.The hacked numbers are 998244353, 10^9+7, 10^9+9 and 19260817(oops). Let's see if you get hacked as well...222 32 32 31 31 30 30 30 30 30 30 30 30 30 30 29 29 29 29 29 29 29 29 29 29 29 29 29 29 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 27 27 27 27 27 27 27 27 27 27 27 27 26 26 26 26 26 26 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 24 24 24 24 24 24 24 24 23 23 23 23 23 23 23 23 23 23 23 23 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 21 21 21 20 20 20 20 20 19 19 18 18 18 18 18 18 18 18 18 18 18 17 17 17 17 17 17 16 16 16 16 16 16 16 16 15 15 15 15 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 12 12 12 12 12 12 12 12 12 12 12 12 11 10 10 10 10 10 10 10 10 10 9 9 9 9 9 8 8 8 8 8 8 8 7 7 7 7 7 6 6 6 5 5 5 4 4 4 4 3 1 
•  » » 3 months ago, # ^ |   +1 How did you create it?
•  » » » 3 months ago, # ^ |   +44 import math A=19260817*998244353*1000000007*1000000009 L=[] for i in range(50,0,-1): while A>=math.factorial(i) : L.append(i) A-=math.factorial(i) print(len(L)) print(L) 
•  » » 3 months ago, # ^ |   +6 I guess i should not complain but it feels bad that other solutions will pass just by having a different prime modulus but mine will fail even though the solution is exactly the same :(
•  » » 3 months ago, # ^ | ← Rev. 2 →   +6 You hacked me, T^T. However, thanks for your ingenious constructions. I have learned a lot from this.
•  » » 3 months ago, # ^ |   0 Nice dude
 » 3 months ago, # | ← Rev. 3 →   -10 Personally, I was disappointed.Because: D was very easy compared to C2. You can guess the formula of E by just looking at the hint. Actually I'm complaining because I'm screwed...
 » 3 months ago, # |   +5 So when will the system test begin？
•  » » 3 months ago, # ^ |   0 After R830 ends.
 » 3 months ago, # |   +20 Speed Forces in Div.1 (
 » 3 months ago, # |   +16 Thanks to the last educational round's problem 1749E - Кактусовая стена, I managed to solve today's D1D. Although they are quite different problems, they both essentially boil down to the same technique — construct a weighted graph with edges between elements connected diagonally (such as black squares on a chessboard), and then run Dijkstra on the graph.
 » 3 months ago, # |   0 splitted-problems-forces
 » 3 months ago, # |   -9 ABD-forces
 » 3 months ago, # |   -8 Can anyone provide pretest 2 for problem C1?
 » 3 months ago, # |   +10 When will system test begin?
 » 3 months ago, # |   0 Jesus D. Christ why do these rounds never have maximal tests in pretests
•  » » 3 months ago, # ^ | ← Rev. 2 →   0 pretest 5 had, you just got unlucky
•  » » » 3 months ago, # ^ |   +2 Bruh
 » 3 months ago, # |   0 Problem D has a bad pre-test, at least for my code, https://codeforces.com/contest/1754/submission/177564421 , I counted twice, but passed the pre-test
 » 3 months ago, # |   +10 Any idea when will we get the rating changes??
 » 3 months ago, # |   +2 Solution for problem DLet $cnt[i]$ the number of times $i!$ appears in the sum, it's a compressed form of the sum. (which can be easily calculated; it's the number of times $i$ appears in $A$). First, let's start from the very simple basic stuff : imagine $cnt[1]$ is equal to $2$. In other words, it means that there is this expression in the sum : $1! + 1!$. But more simply, it can be written as $2 \cdot 1!$. But is there another way of writing this : in fact, since $1! = 1$, $2 \cdot 1! = 2 \cdot 1 = 2!$. So maybe ... we can just add $1$ to $cnt[2]$ (indicating that we have to add $2!$ to the sum) and just set $cnt[1]$ to $0$. Now, more generally what happens if $cnt[1]$ is magnificently big, let's say $500000$. But we can always do the same : add $1$ to $cnt[2]$, remove $2$ to $cnt[1]$. And redo it again, redo it again, .... In this way, we will have $cnt[1] = 0$. But there is a more mathematically and not-time consuming way to do this : it's to just add to $cnt[2]$ ($\left \lfloor {\frac{cnt[1]}{2}} \right \rfloor$), and set $cnt[1]$ to $cnt[1] \text{ mod } 2$. Now imagine after this operation, $cnt[1]$ is equal to 1. That means that the sum is not divisible by $2$ : all the other blocks ($2!, 3!, 4!, 5!, 6!$ have all a factor $2$ inside it, thus divisible by $2$). And that implies that the sum is not divisible by $k!$. Let us continue this algorithm other and other, and check if $cnt[i]$ equal to $0$ (after each operation). At the end, we will have only blocks of $k!$, and that means that the sum is divisible by $k!$ !
 » 3 months ago, # | ← Rev. 2 →   -18 If you could not solve D during contest and want to upsolve it — I suggest that you read about The factorial number system.UPD: OOF FACTORIAL NOT FRACTIONAL damn my typos are f**ked up when its late
 » 3 months ago, # |   +3 Can anyone please tell me why my sol is wrong for D https://codeforces.com/contest/1754/submission/177575412 I have used the fact if two number are divisible than taking prime mod(mod > coefficient) will give the same value
•  » » 3 months ago, # ^ | ← Rev. 2 →   0 I think someone came up with a hack that uses a collision specifically for 1e9 + 7 and 1e9 + 9. Use different primes and it's AC.Edit: Actually they left a comment about it too that I missed :P
•  » » » 3 months ago, # ^ |   0 Thanks
 » 3 months ago, # |   +70 Thanks for the round!I enjoyed this round, especially problem E was interesting!problem F: I calculated (r+1)*(-l+1) instead of r-l+1 and lost the first place.When I corrected that, it actually passed as shown in this submission. Very regrettable :_(Anyway, thank you for preparing good problems!
 » 3 months ago, # |   +4 Is this round unrated?? |#|Contest |Start time |Rank|Solved| |1|Codeforces Round #829 (Div. 2)|Oct/23/2022 15:50UTC+8|— |1 | 
•  » » 3 months ago, # ^ |   0 I don't think so
 » 3 months ago, # |   0 Good round, the difficulty of div2 is very moderate, very suitable for a novice like me, the E questions are not too difficult, I love it!!!
•  » » 3 months ago, # ^ |   0 I enjoyed the problems too! Though I feel like this time around the div 2 was a lot easier, since D2E-D2F was actually doable for me in < 1hr. Though that is from my experience upsolving and not actually in contest :p.
 » 3 months ago, # |   0 The contest is too short for me. If its duration is 2.5 hour. I can solve Div.1 D and have a positive delta. QaQ.
 » 3 months ago, # |   -10 D has bad pre-test.
•  » » 3 months ago, # ^ |   0 not actually
•  » » » 3 months ago, # ^ |   0 1 1 1 this case didnt included in pretest.
•  » » » » 3 months ago, # ^ |   -8 Of course because that case is trivial. duh
•  » » » » » 3 months ago, # ^ | ← Rev. 2 →   0 Hi, your comment is not funny nor helpful. Next time, please refrain from writing such comments. Why is your comment useless? You are claiming that trivial test cases are not in pretests, which is not true at all. Who decides which tests are trivial? Do the authors not put trivial tests in pretests in general? duh? You are laughing just because uchralerdene couldn’t come up with the “trivial” case 1 1 1 during the round?
•  » » » » » » 3 months ago, # ^ | ← Rev. 2 →   0 What decides if a comment is useful or not? I don't know exactly, but I think it's definitely not the 6~10 mfs (Yes, this may include you. I mean YOU, THE ONE READING THIS.) consistently downvoting my comments regardless of content, is it?
•  » » » » » » » 3 months ago, # ^ | ← Rev. 3 →   +3 Some of your comments are definitely useful, I was too pissed off yesterday, sorry. I admit that your comment yesterday was useful.But the comment “Of course because that case is trivial. duh” is definitely useless, because: it’s based on the false claim (that trivial cases are not in pretests) it doesn’t give any information to the OP, it’s just insulting and a lot of your comments (the ones that have negative votes) are like this, which makes some of your valid comments look useless
•  » » » » » » » » 3 months ago, # ^ | ← Rev. 2 →   0 Thanks for your sincere advice, I appreciate it. I always try to suggest points that I consider valid, and I agree that some of them are a bit flawed as you suggested. I'll try to recheck the validity more before I post the comment next time.p.s. The 6~10 consistent downvotes happen on very valid points also (Like the suggestion about adding rated/unrated register), why do they downvote literally every comment of mine? I see absolutely no reason for them to mass-downvote me on these unless the occasion is that they simply hate me.
•  » » » » » » » » » 3 months ago, # ^ | ← Rev. 2 →   -8 I hate you because you make too much comments, many of which turns out to be useless or repetitive. I’m sick of seeing your profile image and your handle in many posts.
 » 3 months ago, # |   +11 The problems are good quality.It suprised me very much.I am looking forward to more contests!
 » 3 months ago, # |   0 In this contest again we had unrated winners and many people with high ranks who it was their first contest and seems to be fake users. time to have some ideas about recognizing fake users and avoid them from participating in contests. Any idea?
 » 3 months ago, # |   0 My solution for 1754B coincidentally coincided with another solution. The obvious reason might be that the solution code was pretty simple and obvious, so there is a high probability that two persons might write significantly similar solutions. Please take this into consideration and accept my submission.
 » 3 months ago, # |   0 I wonder what would have been difficulty of Div2 D if a[i] and x had been up to 10^18
•  » » 3 months ago, # ^ |   +1 Then the answer would not be possible in 10**5 array unless all the elements are equal to x
•  » » 3 months ago, # ^ |   0 Using multiple account during the contest is a clear violation of contest rules.
•  » » » 3 months ago, # ^ |   0 Sorry..I didn't knew that...I have recently started codefoeces
 » 3 months ago, # |   0 You listed 2nd and 3rd places in the wrong order.
•  » » 3 months ago, # ^ |   +3 Thank you! Fixed.
 » 3 months ago, # |   0 EXPERT LES GOOOO
»
3 months ago, # |
0

include<bits/stdc++.h>

using namespace std; int main(){ int t; cin>>t; for(int i=1;i<=t;i++){ int n; cin>>n; int k=n/2; int s=1; for(int i=k+1;i<=n;i++){ cout<<i<<" "; if(s<=k){ cout<<s<<" "; s++; } } cout<<endl; } }

Although here is my solun but i didnt undersatnd at all i can make the more minimum like 4 3 2 1 or its reverse which will give always minmum but after that what is the maximum? i mean which things maximum they have been said? someone said o that 2 3 2 3 this will be the maximum permutaion of 3 1 4 2 5? among of 120 permutation. will anyone please share me how its the maximum permutaion and what is the maxmium of which values? really confused need an experts hand. Thanks

 » 3 months ago, # |   0 有中国人吗？