We invite you to participate in CodeChef’s Starters 190, this Wednesday, 11th June, rated for 5 star (i.e. for users with rating < 2200).
Time: 8:00 PM — 10:00 PM IST
Joining us on the problem setting panel are:
Contest Admin, Statement Verifier and Text Editorialist: Nishank IceKnight1093 Suresh.
Tester: Sushil SmolBrain Raaja.
Setter: Nishank IceKnight1093 Suresh.
Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest. The video editorials of the problems will be available only to Pro users.
Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.
Hope to see you participating.
Good Luck!









Contest starts in ~30min.
Can someone share their ideas for Subsequence Sort and Min-Max Deletion ?
about Min-Max Deletion
first, the result is the sum of the minimums of each pair
then, for each query, when I will change the $$$i_{th}$$$ element, I will erase the minimums from its pairs (its neighbours), then change the element, add the minimums again
here is my solution:
I'm interested in this proof "the result is the sum of the minimums of each pair"
Min-Max Deletion had a pretty simple approach. since we had to maximize the minimum pairwise sum over all indices from 1 to n-1, we first pair up the larger numbers, followed by the smaller ones. after brute-forcing this once on paper, you'll notice that we could have just obtained the result by pairing up every pair of consecutive indices from 1 to n-1.After this, we'll process the queries from the input. For each query, we'll first subtract the contribution of the number at the particular index. Then we'll replace the old number at that index with the new one, and add back its new contribution. this contribution will come from its pair with index-1 and index+1, if they exist.
For Subsequence Sort : So basically there were a few observations that you could come up with: If a[i]>=a[i-1] you skip ahead, otherwise the best choice would be to make a[i]=a[i-1], let me clarify, if a[i]<a[i-1] this means that there exists some set bit with more significant value in a[i-1] than in a[i]. If you have reached till this bit in the operations , this means you have all the lesser bits covered as well, so you just need to find the maximum msb which is set in a[i] but not in a[i-1] across all elements.
For 5 4 9 11 12 , 5>4,the first disparity occurs at 2nd bit , so you need to set it and the rest of the bits below would be automatically managed as to get the value equal to 5.
Solution : ORSUBSORT
" if a[i]<a[i-1] this means that there exists some set bit with more significant value in a[i-1] than in a[i]. If you have reached till this bit in the operations , this means you have all the lesser bits covered as well, so you just need to find the maximum msb which is set in a[i] but not in a[i-1] across all elements.
"
let's say a_i-1 = 0011111 and a_i. = 0011000
you are just setting 2nd bit from right (0-indexed) to 1 right but that won't make it a_i >= a_i-1 , In your code you are breaking at this point. Can you explain how this works.
This question was confusing.
The thing is x increases one by one , so if you have reached any point z, you will have gone through all the smaller values already. So if you can sort the biggest disparity , all the ones below it would have been solved.
0 0 1 1 1 1 1
0 0 1 1 0 0 0 -> for this you set the last bit , but for you to reach there you would have gone step by step from 1 to that point , so every bit before is available to you if you want to set it, this is also the reason why you can make it equal to prev and satisfy the condition
Thanks for sharing your ideas and solutions — they helped me successfully upsolve both problems.
have the contests gotten harder over the years or have you lost problem solving skills because how are at ~1200 now ?