Hi, currently this is the only way for me to make a public comment.
To be honest, I am the owners of both "MRSloth" and "checkingError" accounts. The reason for creating the checkingError account is rather arbitrary; I could not pass the first question named "Matching", so I created a new account called "checkingError" such that I could make experimental submissions on a separate account (-_-). That question was pretty trivial actually. After my second submission for problem A "Matching" got passed using the "checkingError" account, I celebrated for it (-_-) by taking this screenshot,
and proceeded to solve questions B and C, with a final ranking of around 31XX. I could simply leave the contest arena since I was quite tired after working for a full time job (it was around 11:30pm ~ 12:00am here), but then I realized that my old account, MRSloth, stayed in the contest as a registered participant. Therefore, I copied my code for submission B and C using "checkingError" account and pasted them to the submission plane for "MRSloth" account and submitted them. Due to time penalty, "MRSloth"'s final ranking is around 4XXX.
Well, to be honest, after practicing on LeetCode, I have improved a bit. Using log2 is actually a simple idea for 1821C.
Problem statement:
You are given a string s , consisting of lowercase Latin letters. __ In one operation, you can select several (one or more) positions in it such that no two selected positions are adjacent to each other. Then you remove the letters on the selected positions from the string. The resulting parts are concatenated without changing their order. __ What is the smallest number of operations required to make all the letters in s the same?
It is very easy to see that subsequences of the same letters must be located in distinct indices.
Our goal is to make all letters the same or have no letters left. Also, greedily picking the max possible subsequence of the same letter might not give us optimal results (well, this is CodeForce, I ain't saying that LeetCode or other sites are easier, but hey, this is CodeForce (-_-;))
Therefore, despite my average IQ, I magically came up with a slightly non-intuitive idea: Between each letter gap (let such letter = L), there are N letters in-between gaps of L. Because, in one operation, we can pick letters that are not adjacent to each other, and positions of L must be distinct. Therefore, we know that we can consider each letter gap of L, such that the number of times to perform the operation to obtain a string of only Ls / empty is equal to the max no. of operations needed to handle any one letter gap. Slightly non-intuitive, but, to be honest, thousands of people can come up with this, so comparatively speaking, not impressive, but satisfying.
As for why using log2? Because, if we consider each letter gap of Ls, the length of a gap, let's say, is K. Because in each operation, we must pick non-adjacent characters, to do this optimally, we can, starting at the first character, greedily pick all characters that are exactly 1 letter apart from each other. what does that mean? This means that we divide by 2 for size K, which is equivalent to log2(K). As for whether I should round log2 with ceil / floor / abs function, well, it depends on the context. In here, since we need to remove all characters, ceil should be applied. (well at this moment, I haven't checked my answer, but yea, it depends.)
And that's the idea.
I hope the violation record for accounts "checkingError" and "MRSloth" can be waived, although the rankings are not that important anyways. Although I ain't that smart, at least, at that moment, my fking brain came up with an idea from nowhere.
(-_-)/ lol.
Thanks. CodeForce > LeetCode at this moment (-_-)... But no, platforms can't be compared solely based on the difficulty of questions... in my own perspective... (-_-)/
Thanks.
babe wake up new worst post on the site just dropped
Didn’t you read contest rules while registered for the contest? There clearly written using multiple account during contest is rule violation. Dosen't matter how many account belongs to you but you submit from multiple this means those are different person. So yeah you violence the rules of contet.
ok