greateric's blog

By greateric, history, 3 weeks ago, In English

Backstory: "Problem statement v2" was a problem I tried to propose for our round. Unfortunately, a really similar version ("Problem statement v1") has been used before. But then we had the question of if these two problem statements were actually the same or different. Are the answers to both problems always going to be the same, or is there an example out there where they differ?

Problem statement v1

This is a problem you might have seen before.

Eric has $$$n$$$ (where $$$n$$$ is even) poker chips. They are currently in a stack, the bottom one is numbered $$$1$$$, the second-bottom one is numbered $$$2$$$, ..., the top one is numbered $$$n$$$. Eric will shuffle the poker chips by interleaving the bottom half and the top half together. Formally, this permutes the stack from

$$$1, 2, ..., n$$$

to

$$$1, \frac{n}{2}+1, 2, \frac{n}{2}+2, 3, \frac{n}{2}+3, ..., \frac{n}{2}, n.$$$

How many shuffles must he perform to revert to the starting position? (Find the minimum number)

Constraints: $$$n \le 200{,}000$$$.

Solution v1

Spoiler

Problem statement v2

Eric has $$$n$$$ (where $$$n$$$ is even) poker chips once again. The shuffle operation is the same: $$$1, 2, ..., n \rightarrow 1, \frac{n}{2}+1, 2, \frac{n}{2}+2, 3, \frac{n}{2}+3, ..., \frac{n}{2}, n$$$.

But, this time, the bottom $$$m$$$ poker chips are white, and the top $$$n-m$$$ poker chips are green. We are interested in the minimum number of shuffles until all $$$m$$$ white chips are on the bottom and all $$$n-m$$$ green chips are on top again. The stack does not have to be sorted; for example, if $$$n = 6$$$ and the white chips are $$$1, 2, 3$$$ and the green chips are $$$4, 5, 6$$$, then $$$[1, 3, 2, 5, 4, 6]$$$ would count as good.

The problem: Prove that the answer to this problem is always the same as previous (aka if white and green are separated, then the stack must be sorted), or find an example where it is faster to get a white/green stack than a sorted stack.

There is now no constraint on $$$n$$$ other than it has to be even. We avoid the trivial case of $$$m = 1$$$ or $$$n - m = 1$$$, since if there is only 1 chip of either color, then it forever stays on the top/bottom so you get a white/green stack after every operation.

Solution v2

Thanks to Puddles_Penguin, daniel.glabai, and ClaudeFable5 for working through this.

Spoiler
  • Vote: I like it
  • +48
  • Vote: I do not like it

»
3 weeks ago, hide # |
 
Vote: I like it -28 Vote: I do not like it

cheater

  • »
    »
    3 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    damn the legend is back

    • »
      »
      »
      3 weeks ago, hide # ^ |
      Rev. 2  
      Vote: I like it -13 Vote: I do not like it

      Cheater! Cheater! Cheater! ↓↓↓ !!!

      Spoiler

      UPD: bro it's me swastik_P in the photo, don't you recognize my face?

      • »
        »
        »
        »
        3 weeks ago, hide # ^ |
         
        Vote: I like it +5 Vote: I do not like it

        bro really came to cf after a 4 month break to comment this

      • »
        »
        »
        »
        3 weeks ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Bla bla! Bla Bla! Bla Bla!

      • »
        »
        »
        »
        2 weeks ago, hide # ^ |
        Rev. 3  
        Vote: I like it 0 Vote: I do not like it

        idgaf to u bro js stfu at this point

        u dont even have any proof that i have cheated in past "1 year or maybe 11 months" and i have left competitive programming "for now" i am preparing for imo so js stfu u r js a random kid who have nothing to do except spamming god knows when will cf ban your id, i mean it already banned your 3 previous one for same reason right? js imagine login into platform after like 7 months js to see a mf using your 7th grade photo and writing cheater on it like it will do anything js fuck off bro no one cares

        using words like noob trying to add NN in every sentence to sound intelligent like whoahh a another tier of ragebait!

        also wtf did u thought using 3yo photo of a child gonna do to him? wtf do u even want to do at this point? i cheated on cp like a year ago and then i left it, problem fixed right? but u did not u r still continuing spamming u r also a 13yo right? so why the fk r u wasting ur time here go prepare for olympiads!

        • »
          »
          »
          »
          »
          112 minutes ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          I am a cheater, and my photo proves it, also what problem do you have with me writing cheater on my photo? Like you can do that too, if you want, there is no rule saying you can't write 'cheater' on your photo.

  • »
    »
    3 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    you all so noob downvoters, you don't even know, that matrix's filled with numbers can be used for cheating, lmao

    • »
      »
      »
      3 weeks ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      also, if you don't want to cheat, then you can use them in your code, here is how:

      1. write the problem statement in form of a string vector, at the top of your code

      2. integrate the neural network/machine learning model(trained to solve problems), the result output must be in form of a turing machine

      3. process the turing machine, to get the result of all test cases, and output the answers

      even though there will be problems with tle/mle/wa, at least it can work for some problems

»
3 weeks ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Like I was writing a comment asking when is your next useless information blog and saw this lol.

And ClaudeFable5...

»
3 weeks ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

bruh I forgot to glaze greateric.

orz greateric

»
3 weeks ago, hide # |
Rev. 2  
Vote: I like it -8 Vote: I do not like it

bruh (till now) there are 16 comments in this blog and 7 of them are mine.

I guess I glaze greateric a little bit too much.

update: 8 comments now

»
3 weeks ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

Bruh no way this blog only gets 17 upvotes

»
3 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Fun problem