Блог пользователя Dominater069

Автор Dominater069, 2 года назад, По-английски

We invite you to participate in CodeChef’s Starters 154, this Wednesday, 2nd October, rated upto 6 stars (i.e. for users with rating < 2500)

Time: 8:00 PM — 10:00 PM IST

Joining us on the problem setting panel are:

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!

  • Проголосовать: нравится
  • +76
  • Проголосовать: не нравится

»
2 года назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

so jao sir

»
2 года назад, скрыть # |
 
Проголосовать: нравится +36 Проголосовать: не нравится

As a setter, participate or I will send an army of $$$10^9$$$ chefs to your home

»
2 года назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

CF $$$1400$$$ $$$ \gt $$$ CodeChef $$$2000$$$ for some reason :)

»
2 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Nice problems! I'm happy to AKed all. Thanks.

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    can you find any issue for the code below: GCD and Xor

    Spoiler
    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится +17 Проголосовать: не нравится

      Sorry, but ask it to gpt. I only can help your code.

    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится +3 Проголосовать: не нравится

      Add 1 or 2 Game : for N==1 alice wins else Bob wins

      GCD & XOR : observe we can greedily make all elements equal to 1 using X==1, and then make them equal to k using XOR operation with that particular X, which takes 2 operations at max. But if we have all equal to k then we don't have to make any operations so its equal to 0 , else if all are divisible by k then we have to make 1 operation else if all have same needed xor value then also we need 1 operation.

»
2 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

cheatchef hogya aaj to 90% of div 2 participant have same code

»
2 года назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

How to solve Tree Cut XOR if we had to maximize X instead of minimize it ?

  • »
    »
    2 года назад, скрыть # ^ |
    ← Rev. 3  
    Проголосовать: нравится +11 Проголосовать: не нравится

    Let $$$x$$$ be the maximum integer, such that $$$2^x \le n-1$$$, then maximum value of $$$X$$$ can be $$$2^{x+1} -1$$$.

    Let do operations in the following way:

    Observe that we reach $$$2^x, 2^{x-1}, ... ,4, 2, 1$$$ while deleting leaves one by one

    If the number of leaves cut are odd at tree with size $$$4$$$, remove edges $$$1,2,1$$$(sub-tree size) otherwise remove $$$3,1,1$$$

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +16 Проголосовать: не нравится

    For a given value of $$$N$$$, the maximum value that $$$X$$$ can be xorred with is $$$N-1$$$. That gives an upper bound of $$$2^{\lfloor log_2(N-1)+1 \rfloor}-1$$$ on $$$X$$$. Consider $$$N = 4$$$. Note that any value of $$$0 \leq X \leq 3$$$ is obtainable. For $$$N \gt 4$$$, keep removing leaves till $$$N = 4$$$. After the removal of each leaf, let $$$siz$$$ denote the size of the remaining tree. Do $$$X = X \oplus siz$$$ if $$$siz$$$ is a power of $$$2$$$; $$$X = X \oplus 1$$$ otherwise. By this method, we can set all possible bits $$$\geq 2$$$ in $$$X$$$. Once $$$N = 4$$$, any combination of the last $$$2$$$ bits can be obtained. Thus, the upper bound is achievable for $$$N \geq 4$$$. The answers for $$$N = 2$$$ and $$$N = 3$$$ are $$$1$$$ and $$$3$$$ respectively.

    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится +3 Проголосовать: не нравится
      I have a little better way to explain: 
      
      Let say current tree has n nodes,  partition leaf edge
            so we remain with  sz1 = 1  , sz2 = n-1
      
      if n is odd ,  n-1 operation we want = even    so if initially xor = 0
         then   0 ^ (sz1 = 1) ^ (sz1 = 1) .... even time   = 0
      
      if n is even , we can make xor = 1 by the above rule right
           but there is a catch , if n==2  xor = 1 is indeed the answer
                                  if n > 2 xor = 0 is also possible
      
          Let see how ->   first thing  pertiton into sz1 =1  , sz2 = n-1  is still there
                                  n    -->    n-1    --->    n-2
              (sz1 , sz2) =  (1 , n-1)     (1 , n-2)       (1 , n-3)
      
                          0 ^   (n-1)   ^   (n-2)  ^ (rest will be the same problem)
           (n-1)^(n-2) = 1
      
           So if you see that we start with (n =even , xor = 0)    -> apply type1 = 1 as final
           so got to                        (n-2 = even , xor =1)  -> apply type1 = 1^starting - 0
      
      
      
      
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I had a doubt in COUNTWINSUB , like I interpreted it to find the number of subarrays which have more 1's than 0's , is this wrong ?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

You can check my video editorials of Count Winning Subarrays and Tree Cut Xor if needed

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

For MINMAXPATHS, what's the proof that:

Spoiler