manish.17's blog

By manish.17, 2 months ago,

Hi again, Codeforces!

fishy15, flamestorm, ScarletS, saarang and I are glad to invite you to our second Constructiveforces round, Codeforces Round #836 (Div. 2), which will be held on Nov/25/2022 18:35 (Moscow time). The round will be rated for participants with rating lower than 2100.

We'd especially like to thank:

You will have 2 hours to work on (and solve!) 6 problems. At most one of the problems will be interactive. Make sure to read this blog and familiarize yourself with these types of problems before the round! You are highly encouraged to read all the problems ;).

The scoring distribution is $500-1000-1500-1750-2250-3000$.

Good luck, and see you on the scoreboard!

UPD1: Thanks to ak2006 for making video editorials for some of the problems.

UPD2: Editorial is out!

UPD3: Congrats to the winners:

Div. 1 + 2:

1. jiangly
2. SSRS_
3. kotatsugame [tie]
4. Maksim1744 [tie]
5. March_7th

Div. 2:

• +95

 » 2 months ago, # |   +78 omg saarang round
•  » » 2 months ago, # ^ |   +58 omg saarang round
•  » » » 2 months ago, # ^ |   +71 omg saarang round
•  » » » » 2 months ago, # ^ |   +73 omg saarang round
•  » » » » » 2 months ago, # ^ |   +46 omg saarang round
•  » » » » » » 2 months ago, # ^ |   +35 omg saarang round
•  » » » » » » » 2 months ago, # ^ |   +32 omg saarang round
•  » » » » » » » » 2 months ago, # ^ |   +22 omg saarang round
•  » » » » » » » » » 2 months ago, # ^ |   +22 omg saarang round
•  » » » » » » » » » 2 months ago, # ^ |   +9 omg saarang round
•  » » » » » » » » » 2 months ago, # ^ |   -10 omg saarang level, why am I writing this?
•  » » » » » » » » » 2 months ago, # ^ |   +9 omg saarang round
•  » » » » » » » » » 2 months ago, # ^ |   0 Who is saarang ?
•  » » » » » » » » » 2 months ago, # ^ |   +126 Who is saarang? 🤔 For the blind, 🦇 it is light. 💡 For the hungry 😣 , it is bread. 🍞 For the sick, 💉 it is the cure. ⚕️ For the sad 😢 , it is joy. 😂 For the poor 🚫💰 , it is the treasure; 💰 ⛏️ for the debtor ➖ 💰 , it is forgiveness. 🙏 For the face 😶 , it is the lips 👄
•  » » » » » » » » » 2 months ago, # ^ |   +42 Who is saarang? 🤔 For the blind, 🦇 it is light. 💡 For the hungry 😣 , it is bread. 🍞 For the sick, 💉 it is the cure. ⚕️ For the sad 😢 , it is joy. 😂 For the poor 🚫💰 , it is the treasure; 💰 ⛏️ for the debtor ➖ 💰 , it is forgiveness. 🙏 For the face 😶 , it is the lips 👄
•  » » » » » » » » » 2 months ago, # ^ |   +33 Who is saarang? 🤔 For the blind, 🦇 it is light. 💡 For the hungry 😣 , it is bread. 🍞 For the sick, 💉 it is the cure. ⚕️ For the sad 😢 , it is joy. 😂 For the poor 🚫💰 , it is the treasure; 💰 ⛏️ for the debtor ➖ 💰 , it is forgiveness. 🙏 For the face 😶 , it is the lips 👄
•  » » » » » » » » » 2 months ago, # ^ |   +3 And for a 30 year old bachelor man?
•  » » » » » » » » » 2 months ago, # ^ | ← Rev. 2 →   -27 omg saarang round
•  » » » » » » » » » 2 months ago, # ^ |   0 omg saarang round
•  » » » » » » » » 2 months ago, # ^ |   -19 omg saarang round
•  » » » » » » » » » 2 months ago, # ^ | ← Rev. 4 →   -23 omg saarang round
•  » » » » » » » » 2 months ago, # ^ | ← Rev. 3 →   0 Waiting for saarang to say, OMG saarang round.
•  » » » » 2 months ago, # ^ |   -11 lol
•  » » 2 months ago, # ^ |   -24 blue surand round, must be trivial
•  » » 2 months ago, # ^ |   0 omg saarang round
 » 2 months ago, # |   0 Not Not Shading :D
 » 2 months ago, # |   +13 OMG the moment has come. The best round ever is here. I really enjoyed a lot testing it, I'm very proud of y'all, you're great problemsetters ;) Hopefully you'll enjoy it as much as I did.
 » 2 months ago, # |   +13 oh eem gee guysss!!!? how did saarang, a blue coder set a div2????⊙＿⊙?? im literally shaking and crying in disbelief..!
•  » » 2 months ago, # ^ |   +34 oh eem gee guysss!!!? how did tibinyte, a Leafeon. coder set a div1????⊙＿⊙?? im literally shaking and crying in disbelief..!
 » 2 months ago, # | ← Rev. 2 →   +5 As a tester I can assure you that the problems have very good quality and are fun, you can't miss the opportunity to participate in this contest :)
 » 2 months ago, # |   +16 As a tester, I'm sad because I can't participate
 » 2 months ago, # |   0 Among us
 » 2 months ago, # |   -37 As a tester I can assure you that the problemsetters have very good quality and are fun, you can't miss the opportunity to play games with them in this contest :)
 » 2 months ago, # |   0 "At most one of the problems will be interactive." That feeling when the number of interactive problems is in the range of $[1,1]$
•  » » 2 months ago, # ^ |   +3 Did you find it?
•  » » » 2 months ago, # ^ |   +13 you got me there
 » 2 months ago, # |   +18 As a non non-tester I have not not tested and the problems were not not good.
 » 2 months ago, # |   +78 As a tester I must say that one of the authors, namely ScarletS, has a huge skill issue when it comes to Codenames.
•  » » 2 months ago, # ^ |   +35 As an author I must say that one of the testers, namely AlperenT, has a huge skill issue when it comes to Codenames.
 » 2 months ago, # |   +55 As a tester, I must say that atodo and AlperenT are the most based codenames spymasters ever.
•  » » 2 months ago, # ^ |   +32 Who's atodo?
•  » » » 2 months ago, # ^ |   +40 my alt.
•  » » » » 2 months ago, # ^ |   -8 Are u that same Eliska who won silver in IMO?
•  » » » » » 2 months ago, # ^ |   +48 The fan club grows...
•  » » » » » » 2 months ago, # ^ |   +24 prvocislo orz
•  » » » » » » » 2 months ago, # ^ |   +16 AlperenT orz ヾ(≧ ▽ ≦)ゝ
•  » » 2 months ago, # ^ |   0 As a tester, I must say you and suneeta are scammers >;(
•  » » 2 months ago, # ^ |   +8 prvocislo orzorzorz.
 » 2 months ago, # |   0 omg saarang round
 » 2 months ago, # |   +9 Meme
 » 2 months ago, # |   0 When there are multiple problem setters, how do people decides who makes the announcement post and gets the contribution? Coin toss may be?
•  » » 2 months ago, # ^ |   +60 Battle Royale.
 » 2 months ago, # | ← Rev. 3 →   0 seemed like a joke but not.
 » 2 months ago, # |   +1 omg indian round
 » 2 months ago, # |   +39 As a tester, atodo didn't test.
•  » » 2 months ago, # ^ |   +41 As a tester, SlavicG didn't test.
 » 2 months ago, # |   +6 manish.17 orz
•  » » 2 months ago, # ^ |   +6 Yes manish.17 orz indeed.
 » 2 months ago, # |   +10 As a Tester please give me contribution.
 » 2 months ago, # |   +1 thanks for the round
 » 2 months ago, # |   +2 manish.17-fan-club
•  » » 2 months ago, # ^ |   +1 manish.17 Fanclub (2)
•  » » » 2 months ago, # ^ |   +1 manish.17 fanclub(3)
•  » » » » 2 months ago, # ^ |   0 manish.17 fanclub(4)
 » 2 months ago, # |   0 As a tester I want to admit something, saarang is my inspiration.
 » 2 months ago, # |   -20 I hope the constructiveforces part is a joke
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 This aged horribly. Round was still amazing though
•  » » 2 months ago, # ^ |   +3 We're honest people.
 » 2 months ago, # |   +5 As a tester
 » 2 months ago, # |   -38 The round clashes with Ecuador vs Netherlands, can it please be postponed?
•  » » 2 months ago, # ^ |   +42 The round does not clash with Ecuador vs Netherlands.Ecuador vs Netherlands clashes with the round.
•  » » » 2 months ago, # ^ |   -16 The world cup happens once every 4 years, contests happen 4 times a week
•  » » » » 2 months ago, # ^ |   +5 There have been 21 World Cups plus the current one, but there have only been 2 saarang rounds. Спойлер
•  » » 2 months ago, # ^ | ← Rev. 2 →   -49 Agreed. FIFA is obviously more important than some silly contest. Please reschedule the round.
 » 2 months ago, # |   -15 I hope speedforces round
 » 2 months ago, # |   0 As a tester, this round was pretty fun to test. Hope the same holds for participants too!
 » 2 months ago, # |   0 What should I write ⚫⁔⚫.
 » 2 months ago, # |   0 All the best everyone,Hope it will be great round.
 » 2 months ago, # |   0 Hoping to do A,B,C
 » 2 months ago, # |   0 manish.17 You are the great python coder!!. I'm very excited to participate on this round.
 » 2 months ago, # |   0 Hope this round will make expert.
 » 2 months ago, # |   0 Note the unusual timing.
•  » » 2 months ago, # ^ |   +2 Okay
 » 2 months ago, # |   +5 As a former POTUS, I sure hope this round is good.
 » 2 months ago, # | ← Rev. 2 →   -40 ..
 » 2 months ago, # |   +34
•  » » 2 months ago, # ^ |   0 exactly
•  » » 2 months ago, # ^ | ← Rev. 2 →   +1
•  » » » 2 months ago, # ^ |   0 codeforces gonna fail me in the endsems for sure :/
•  » » 2 months ago, # ^ |   0 same here bro
•  » » » 2 months ago, # ^ |   0 Great round in my opinion. How about you?
•  » » » » 2 months ago, # ^ |   0 I solved two problems only ....
•  » » » » » 2 months ago, # ^ |   0 It took me long to solve C
 » 2 months ago, # |   +9 This is my first round . Good luck to everyone :)
•  » » 2 months ago, # ^ |   +9 Do you have any previous history in competitive programming? I mean do you participate on other websites?
 » 2 months ago, # |   0 Hope to get to Master.
•  » » 2 months ago, # ^ | ← Rev. 3 →   +2 Hey. Where did you practice from May 2021 to July 2022? I mean which website? You grew up very very fast.
•  » » 2 months ago, # ^ |   0 Hi, I have solved around 400 problems on codeforcesI want to know how to improve more. what are the things I am doing wrongPlease check my profile- https://codeforces.com/profile/NamanKedia
•  » » » 2 months ago, # ^ |   0 how old are you?
•  » » » 2 months ago, # ^ |   0 Half of this 400 problems are problems with raiting 800. Try to solve more interesting and harder problems)
 » 2 months ago, # | ← Rev. 2 →   +1 Please note that this contest (div 2) is start from an unusual time!
•  » » 2 months ago, # ^ |   -11 Yeah. It's written in bold in the announcement. No need to put useless comments down here.
 » 2 months ago, # |   +6 Good luck to all participants of this round, hope to positive delta
 » 2 months ago, # |   0 Good luck everyone! Time to grind
 » 2 months ago, # |   +57 omg Ali_ZaiBug round
•  » » 2 months ago, # ^ |   +57 omg Ali_ZaiBug round
•  » » » 2 months ago, # ^ |   +49 omg Ali_ZaiBug round
•  » » » » 2 months ago, # ^ |   +49 omg Ali_ZaiBug round
•  » » » » 2 months ago, # ^ |   +38 omg Ali_ZaiBug round
•  » » » » » 2 months ago, # ^ |   +31 omg Ali_ZaiBug round
•  » » » » » » 2 months ago, # ^ |   +22 omg Ali_ZaiBug round
•  » » » » » » » 2 months ago, # ^ |   +28 omg Ali_ZaiBug round
•  » » » » » » » » 2 months ago, # ^ |   +22 omg Ali_ZaiBug round
•  » » » » » » » » » 2 months ago, # ^ |   +19 omg Ali_ZaiBug round
•  » » » » » » » » » 2 months ago, # ^ | ← Rev. 2 →   +17 omg Ali_ZaiBug round
•  » » » » » » » » » 2 months ago, # ^ |   +2 omg Ali_Zaiback round
•  » » » » » » » » » 2 months ago, # ^ | ← Rev. 2 →   +8 omg Ali_ZaiBug round
•  » » » » » » » » » 2 months ago, # ^ |   +8 omg Ali_ZaiBug round
•  » » 2 months ago, # ^ | ← Rev. 2 →   +6 omg Ali_ZaiBug round
•  » » 2 months ago, # ^ |   +3 omg Ali_ZaiBug round
•  » » 2 months ago, # ^ |   0 omg Ali_ZaiBug round
•  » » 2 months ago, # ^ |   0 omg Ali_ZaiBug round
•  » » 2 months ago, # ^ |   0 omg Ali_Zaiback round
•  » » 2 months ago, # ^ |   0 omg Ali_ZaiBug round
 » 2 months ago, # |   +24
 » 2 months ago, # |   +6 omg Ali_ZaiBug round
 » 2 months ago, # |   +3 omg Ali_ZaiBug round
 » 2 months ago, # |   0 omg Synapse_13 round
 » 2 months ago, # | ← Rev. 2 →   0 omg Ali_ZaiBug round
 » 2 months ago, # |   +1 SpeedforcesAB
•  » » 2 months ago, # ^ |   0 SpeedforcesABCD
 » 2 months ago, # | ← Rev. 2 →   +5 Samples are quite nice. ;)
 » 2 months ago, # |   -8 Contest=Xor
 » 2 months ago, # |   +33 Cool, unorthodox problems. Good job and thanks setters! Had fun.
 » 2 months ago, # |   -35 I really hate constructing sequence problems, and no one can convince me that these types of problems are useful for competitive programming. They are basically hit or miss. Shit problems!
•  » » 2 months ago, # ^ |   +6 constructive problems require you to be creative
 » 2 months ago, # |   +6 There was hardly any implementation before E ...
 » 2 months ago, # |   +9 Constructive Round ^^
 » 2 months ago, # |   0 Div1Forces
 » 2 months ago, # |   0 Any hint for D?
•  » » 2 months ago, # ^ |   0 Take the sum of the sequence to be $k^2n^2$ and then take the elements of the sequence to be $a, a+1, a+2, \dots, a+\frac n2 - 1$ along with $a+kn, a+kn-1, \dots, a+kn-\frac n2 + 1$ for some $a$. (I know I've added an extra term if $n$ is odd, feel free to remove it from either side) Now try to find ways to determine the value for $k$ and $a$.Hint 2: Consider cases where $n$ is even and odd seperately.
•  » » 2 months ago, # ^ |   +4 Solution for D:If $n$ is even:Let $\Sigma a[i]=n^2$.$a[]=...,n-2,n-1,n+1,n+2,...$.Sample:$n=6$$a[]=3,4,5,7,8,9If n is odd:Let \Sigma a[i]={(n+1)}^2=n^2+2n+1.a[]=(n-n/2)+1,...,(n-2)+2,(n-1)+2,n+2,(n+1)+2,(n+2)+2,...,(n+n/2-1)+3,(n+n/2)+3.Sample:n=5$$a[]=4,6,7,9,10$
 » 2 months ago, # |   0 how to solve B what's the idea ?
•  » » 2 months ago, # ^ |   0 if n is odd print 1 1 1 1 1 1.... else print 1 3 2 2 2 2 ...
•  » » » 2 months ago, # ^ |   0 if n is odd print n else print n-2 time 2 and 3 1
•  » » 2 months ago, # ^ |   +1 1 xor 3 = 2 and (1 + 3) / 2 = 2
•  » » 2 months ago, # ^ |   0 Not the most obvious or best solution, but this is how I did itI basically made 2 cases, if n is odd : put a1 = a2 = ... = an as any number x as their XOR will be x and their sum will be n(x)/x = x if n is even : put a1 = a2 = ... = an-2 as 2 and put an-1 as 1 and an as 3 so that their xor will be 1xor3 = 2 and their sum will be (2(n-2)+1+3)/n = 2
•  » » » 2 months ago, # ^ | ← Rev. 2 →   0 I got an idea for the same observation but I thought it was wrong.because i used in even state (a1 = a2 = ... = an-2 as 1) Instead of (a1 = a2 = ... = an-2 as 2)
•  » » 2 months ago, # ^ |   0 Dunno about the idea of the authors but I've came to a pretty beautiful solution with repeating any number if n is odd. (num ^ num ^ ... ^ num = num) and (num*n/n = num). And if number is even, you can just print 1, 3 and 2 (n — 2) times.
•  » » 2 months ago, # ^ |   +2 for even you can also print 1, n + 1, n + 1, ...
 » 2 months ago, # |   0 for problem C if n%k != 0 then we can't form a permutation . but or we can simply place n in kth index and we'll be done why wouldn't this work anyone ?
•  » » 2 months ago, # ^ |   +3 Take for example 8 2Your method would give 2 8 3 4 5 6 7 1But I can also construct 2 4 3 8 5 6 7 1 which is lexicographically smaller due to having 4 instead of 8.
•  » » 2 months ago, # ^ |   +3 This is not the lexicographically minimal solution For example n=12,x=3 you can form a_3=6,a_6=12, others equal to i
•  » » 2 months ago, # ^ |   0 The statement asks you to get the smallest lexicographical answer.
•  » » 2 months ago, # ^ |   0 since we want lexicographically minimum permutation and we have to place an element at position x, we should try to get minimum value which is a multiple of x at that position. Smallest one which we can get is 2 * x, then we need to place n at 2 * x , that is possible only if n is divisible by 2 * x, try thinking in this way..
•  » » 2 months ago, # ^ |   0 i get it now thank you all .
 » 2 months ago, # |   0 I submitted 5 sec before for Q3 but it said that contest over can you kindly accept the solution. Since it didn't compile in time it didn't accept
 » 2 months ago, # |   -8 next time please try to vary the problems a bit, not stupid constructive problems everywhere.
 » 2 months ago, # |   0 The problems were really fun!However, I suspect the solutions for A,B, and C were leaked. While hacking, I noticed a bunch of grey coders with the same mistake in C: returning -1 if n>>16 == x, which doesn't seem related to the problem at all. This fails for testcase 1 199998 3
•  » » 2 months ago, # ^ |   +3
•  » » » 2 months ago, # ^ |   0 It gets harder to outperform cheaters... Soon they're gonna leak solutions to Ds, I suppose. Dirty s.
•  » » 2 months ago, # ^ |   0 please help in finding the mistake i am doing my logic was that each element must be in its own place of that index and if it is not the case it must be divisible by n if it was given as x
•  » » » 2 months ago, # ^ |   0 Think about this cases and you will find your answer: 8 2 and 6 2answer for 8 2 -> 2 4 3 8 5 6 7 1 answer for 6 2 -> 2 6 3 4 5 1
 » 2 months ago, # |   +15 Is this Construct forces? What is your fetish with construct the sequence folks ?
 » 2 months ago, # |   +6 ConstructiveForces
 » 2 months ago, # |   0 omg Ali_ZaiBug round
 » 2 months ago, # |   +18 Similar but not same problem for E: here
 » 2 months ago, # |   0 Very interesting round. Can't wait for the editorial to see the D problem solution with diffrent numbers.
 » 2 months ago, # | ← Rev. 2 →   +8 Nice round thanks!I will agree with other people that ABCD all being constructive is slightly boring, but I would rather have 6 good constructives than 6 varied but mediocre problems (also I guess im slightly biased lol).
 » 2 months ago, # |   0 Can someone please help me figure out what is wrong in my code for problem C ?https://codeforces.com/contest/1758/submission/182540182
•  » » 2 months ago, # ^ |   0 If(temp%x==0) found=1This part is wrong. What if x=6, n=36 Your code will show found 1. But it should go like this.. 6,12,24,48..it will not find n=36
•  » » » 2 months ago, # ^ | ← Rev. 3 →   0 I am getting ans as 6 2 3 4 5 18 7 8 9 10 11 12 13 14 15 16 17 36 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 1
•  » » » » 2 months ago, # ^ |   0 Yeah, but what if n=x. Did you handle that?
•  » » » » » 2 months ago, # ^ |   0 Ok i finally figured out what was wrong. I handled n = x case but i was focusing on placing n as far as possible , instead i should have focused on putting smaller numbers first. Thanks
 » 2 months ago, # |   0 When will upsolving be opened?
 » 2 months ago, # |   0 Nice contest of constructives Thx for this amazing contest.
 » 2 months ago, # | ← Rev. 2 →   +1 For those who are unable to solve C, try finding the ans for n=60, x=2
•  » » 2 months ago, # ^ |   0 -1
•  » » » 2 months ago, # ^ |   0 2 6 3 4 5 1 isn't it correct?
•  » » » » 2 months ago, # ^ |   0 Yes. My mistake.
•  » » 2 months ago, # ^ |   0 thanks
 » 2 months ago, # |   0 Why is it wrong? Problem C https://codeforces.com/contest/1758/submission/182533063
•  » » 2 months ago, # ^ |   0 i dont know
•  » » 2 months ago, # ^ |   0 for this test case : Spoiler1 12 2 your answer is -1, but it should be : 2 4 3 12 5 6 7 8 9 10 11 1
•  » » » 2 months ago, # ^ |   0 thanks
 » 2 months ago, # | ← Rev. 2 →   0 For the problem D, I got the answer when n is even , but for the odd n , I tried a lot but didn't get. I was trying to use the seq: (sum of 1st n odd numbers ) = n*n , and to maintain the max-min diff, I manipulated this odd numbers sequence like I made this diff to be equal to n so that n*n matches with the sum but failed when n is odd , in this case 1 value was always repeating. Can someone please help for odd n.
 » 2 months ago, # | ← Rev. 4 →   0 my solution for D:if n is even, let say max — min is 2n then we can have half 5n and half 3n, if you do the sum it is exactly 4n^2. 5n * n/2 + 3n * n/2 = 4n^2 = (2n)^2.if n is odd, we can compute for cases where n >= 7. add another 3n and reduce 3n from the 5ns. Sum is still 4n^2if n is 3 or 5, then just find some cases that work. Example already has case 5.To make number distinct just add minus from the first half, and add the same thing in the second half. They are guaratee to be distinct because 5n and 3n is a large range and we only have n/2 numbers This solution is very tedious. Is there a better solution than this?
•  » » 2 months ago, # ^ |   0 There is this. But I don't think it's pretty.
•  » » » 2 months ago, # ^ |   0 Thanks ! Nice Solution
•  » » 2 months ago, # ^ | ← Rev. 2 →   +3 I solved D by two pointers technique about min and max of array.Let's call the minimum and maximum of $A$ are $m$ and $M$, respectively.Then the minimum sum occurs at [ $m$, $m+1$, $m+2$, ..., $m+N-2$, $M$ ], and the maximum sum occurs at [ $m$, $M-N+2$, $M-N+3$, ..., $M-1$, $M$ ].Hence, $\dfrac{(N - 1)(2m + N - 2)}{2} + m \le (M - m)^2 = s \le \dfrac{(N - 1)(2M - N + 2)}{2} + M$where $s$ is the sum of $A$.So run a while loop until find the inequality above met. In each loop, increase $m$ by $1$ if $(M - m)^2$ is lower than range, or increase $M$ by $1$ otherwise.After finding $m$ and $M$, it's easy to find the solution. (Just equally increase the elements of $A$ starting from the minimum sum case, until the sum meets $(M-m)^2$)
 » 2 months ago, # |   +5 Sir, prease give my rating beck. What do I have to do with your nonsense?Deepesson You give my rating back imediately
•  » » 2 months ago, # ^ |   +24 I should be the one asking: why did you ping me with your nonsense?
•  » » 2 months ago, # ^ |   0 Y'll get around -135 from this round
 » 2 months ago, # |   0 https://codeforces.com/contest/1758/submission/182524851 I literally can't find what's wrong in my solution, can anyone please show why this solution is wrong?
•  » » 2 months ago, # ^ |   0 Try for 8 2 , it would fail at (8,2),(16,2)....
 » 2 months ago, # |   0 Yeah, it was very good, i like it
 » 2 months ago, # |   0 Can some please explain to me why my solution — 182545721, is giving a time limit exceeded error? While this solution is not 182533564.
•  » » 2 months ago, # ^ |   0 Heads up, Java codes are incoming.
•  » » 2 months ago, # ^ |   0 I think it's because you used System.out.println for the last loop, while the other person used StringBuffer to build the string and then output it in one go.
•  » » » 2 months ago, # ^ |   0 Here's your code with printwriter instead of System.out: https://codeforces.com/contest/1758/submission/182552519
•  » » » » 2 months ago, # ^ |   0 Thanks :)
 » 2 months ago, # |   0 my solution for C :If n%x != 0 then there is no answer, else p[x]=n. Let j be the current index of n in the permutation, iterate from x+1 to n-1 and , when you find an integer i such that n%i == 0 and i%j==0 swap(i,j).Unfortunately the solution is wrong, can anyone help me find the mistake ?
•  » » 2 months ago, # ^ |   0 You have to set $p[n] = 1$ at the end after $p[x]=n$, otherwise you are overwriting it when $x == n$
•  » » » 2 months ago, # ^ |   0 the case where n==x is handled by the if statement already
•  » » » » 2 months ago, # ^ |   0 you're right, your problem is the break, you should have pushed more the n to the last position you could so that the solution is lexicographically the smallest
•  » » » » » 2 months ago, # ^ |   +1 OMG it was never intended to put it there, I forgot to delete it after changing the solution. OMG that's tragic. Thank you for your help!
•  » » 2 months ago, # ^ |   0 It’s not a “solution”, if it’s giving wrong answer
•  » » » 2 months ago, # ^ |   0 It is indeed a solution, I just made a mistake while coding it (forgot to delete a break statement). It got AC in the end.
 » 2 months ago, # |   +1 Meme
 » 2 months ago, # |   +12 Screencast with commentaryAlso, problem E should not appear in rated contests.
•  » » 2 months ago, # ^ |   +3 Why?Is it because there is a known problem very similar to it?
•  » » » 2 months ago, # ^ |   0 Yes, this is a very well-known setup, and there wasn't any new spin on it.
 » 2 months ago, # | ← Rev. 2 →   +3 Feeling sad that I almost solved d but couldn't able to submit within time otherwise it was very good contest as per my side!!! My problem D sol.n: 182548322 It was random approach i get to by trying some no.s i get that for every n , 2*n + 1 could a valid difference of maximum of a[i] — minimum of a[i]. If you know the explanation pls let me know!!!
 » 2 months ago, # |   +14 Alternative solution for DIt works only for $n > 3$, so cases then $n=2$ or $n=3$ should be solved by hand (or bruteforce)It is well known that $1 + 3 + \dots + 2\cdot n - 1 = n^2$ and $max - min$ in this case is equal to $2\cdot n -2$.Let's decrease second and third numbers by 1 and increment last number by 2, so we will have: $1,2,4,7 \dots 2\cdot n-3, 2\cdot n+1$ and now $max - min = 2\cdot n$.How to get the sum equals to $4\cdot n^2$? We can add $3\cdot n$ to every number!Thus, we have $sum = n^2 + 3\cdot n \cdot n = 4\cdot n^2$ and $max-min$ will not change.
•  » » 2 months ago, # ^ |   0 I think my approach is similar to u but i didn't have explanation as of u by the submission. thanks
 » 2 months ago, # | ← Rev. 3 →   +2 This channel leaked ABC during contest. Can we find all the cheaters who copied problem C and just perma ban them? Close to 1k views on problem Chttps://www.youtube.com/watch?v=vGpNQQo-NPII think their solution C is unique enough to id the cheaters
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 Their solution for c failed on system testing (Run time error).
•  » » » 2 months ago, # ^ |   0 Nop, many of them passed it out
•  » » 2 months ago, # ^ |   0 @MoreAnyNot really? I'm asking myself how do you know that? Maybe you submitted it yourself?
 » 2 months ago, # |   0 Really nice problem E.
 » 2 months ago, # |   0 I don't understand why problem D was included in the contest especially at the rank of D and the cut off point for most participants, it doesn't take any algorithm to solve nor can any interesting observations be made. otherwise great contest.
 » 2 months ago, # |   0 Loved the contest, thinking 1,3 in problem B was helpful. Saw C, tried, failes :D.
•  » » 2 months ago, # ^ |   0
 » 2 months ago, # |   0 Please help me figure out what's wrong with my C https://codeforces.com/contest/1758/submission/182541955
•  » » 2 months ago, # ^ |   0 Why do you think multiply only by 2 is enough? x=3,n=27 will hack your solution. Output isn't even a permutation.
•  » » » 2 months ago, # ^ |   0 I get it, my bad. Thanks though
 » 2 months ago, # | ← Rev. 2 →   0 Problem C.One of the test cases is 6 2CF answer is 2 6 3 4 5 1 .... shouldn't it be 2 3 6 4 5 1?Updated: I got the error
•  » » 2 months ago, # ^ |   0 no in your sol.n 3 is not divsible by 2 the 2nd index
•  » » » 2 months ago, # ^ |   0 Thank you
 » 2 months ago, # |   0 Simple greedy solution for D: To give ourselves a bit of wiggle room let Max-Min be equal to 10*n, Then let the square of this expression be x Initialize the array from 1 to n as you normally would with a[i]=i for 1<=i<=n-1 and a[n]=1+10*n, let the cost of this initialization be MIN . Then we can increment every element by 1 and reduce the leftover of x by ((x-MIN)/n)*n. Now we can greedily spend the rest of X incrementing elements starting from the back. it is easy to see that 10*n difference is more than enough because after step 3 x will be strictly less than n which is less than the difference between the sum of numbers from (10*n-n+1, 10*n-n+2..., 10*n); — (1, 2..., n).
 » 2 months ago, # |   0 Maybe it's impossible for an expert to solve only 2 problems during Div2, but today i realized it. Thanks to this round, I will practice more to improve myself. :)
•  » » 2 months ago, # ^ |   0 I don't think it's an indication of how good you really are at solving problems. Indeed, no one expected so many constructs in a row
•  » » » 2 months ago, # ^ |   0 C was not constructive however
 » 2 months ago, # |   +20 Finally, Candidate Master, thank you for the contest.)
•  » » 2 months ago, # ^ |   +11 Congrats for CM.
•  » » 2 months ago, # ^ |   +5 Callmepandey:orz:
 » 2 months ago, # | ← Rev. 3 →   0 Finally,pupil! This contest will be remembered :")
 » 2 months ago, # |   +9 Problem description was very short and clear. I like it. Problem set was also logical and efficient. Just wow round.❤️
 » 2 months ago, # |   +8 Reached expert with master performance today. Thank you for the constructiveforces round.
•  » » 2 months ago, # ^ |   0 orz kelin sexpert
 » 2 months ago, # |   +1 Please consider that their is a YouTube channel that post the problems code during contest time https://youtu.be/vGpNQQo-NPI
 » 2 months ago, # |   0 182612492can anyone tell me why i am getting runtime error! i tried with prime factorization and swapping
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 Line 19. p -= p // i looks wierd. Shouldn't it be p = p // i ? As a result, list b contains much more numbers than it should, thus you get index-out-of-range error later.Edit: Fix this error and get accepted.
•  » » » 2 months ago, # ^ |   0 Got it hours ago. Thanks for reply
 » 2 months ago, # |   0 What is expectation raitong for C and D
•  » » 2 months ago, # ^ |   0 0
 » 2 months ago, # |   +1 Hi ,this contest had a different style than other codeforces contests. Other codeforce contexts are more algorithmic. But this contest had a more creative style. If this style of contest is going to be held again, please have its own type. Thankful
 » 2 months ago, # |   0 Has this round turned unrated?
»
2 months ago, # |
-8

what is wrong in my code

include<bits/stdc++.h>

using namespace std; typedef long double ld;

define int long long

const ld eps=1e-6; const int N=1e6; const int M=1e9+7; vectorprimes;

void solve(){ int n,x;cin>>n>>x;setst;

vectorans; for(int i=2;i<=n;i++)if(i!=x)st.insert(i); for(int i=2;i<n;i++){ if(st.find(i)!=st.end()) {ans.push_back(i);st.erase(i);} else if(st.find(2*i)!=st.end()){ans.push_back(2*i);st.erase(2*i);} else {cout<<-1<<endl;return;} }cout<<x<<" "; for(int i=0;i<ans.size();i++)cout<<ans[i]<<" "; cout<<1<<endl;

}

signed main(){ int t=1;cin>>t; while(t--) solve(); }

 » 2 months ago, # | ← Rev. 5 →   0 An awesome round it was.