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:
Contest Admin: Shreyan Dominater069 Ray
Setters: Sushil SmolBrain Raaja, Shreyan Dominater069 Ray
Tester: Sushil SmolBrain Raaja
Text Editorialists, and Statement Verifier: 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!
so jao sir
As a setter, participate or I will send an army of $$$10^9$$$ chefs to your home
Then I will solve all their problems one by one, and in return they will cook food for me and me and my friends would laugh the same way as your pfp
As long as the chefs bring snacks, I'm ready
let them cook
CF $$$1400$$$ $$$>$$$ CodeChef $$$2000$$$ for some reason :)
what s the equivalent for 1700-1800 cf problems in codechef ?
That's probably 2100+.
The contest starts in ~35 mins
Nice problems! I'm happy to AKed all. Thanks.
can you find any issue for the code below: GCD and Xor
// code ~~~~~ int main() { ios::sync_with_stdio(false); cin.tie(nullptr);
} ~~~~~
Sorry, but ask it to gpt. I only can help your code.
Add 1 or 2 Game
: for N==1 alice wins else Bob winsGCD & XOR
: observe we can greedily make all elements equal to1 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 haveall 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.did the same in the code, would be helpful if you check it. thanks
should have thought of that making everything 1 by gcd (it was almost like using 1 to swap elements ,question in last contest) my baddd
You're not checking if one of the numbers is k in case of two distinct values. Try this case.
cheatchef hogya aaj to 90% of div 2 participant have same code
How to solve Tree Cut XOR if we had to maximize X instead of minimize it ?
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$$$
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 > 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.
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 ?
Yeah think about this testcase: 0 0 0 0 0 1 1
You can check my video editorials of Count Winning Subarrays and Tree Cut Xor if needed
Didn't think you'd participate. I guess holiday today :)
For MINMAXPATHS, what's the proof that:
$$$a \cdot x + b \cdot y > \min(a,b) \cdot \max(x,y)$$$ for any positive $$$a$$$, $$$b$$$, $$$x$$$, $$$y$$$?
$$$a \cdot x + b \cdot y \ge min(a, b) \cdot (x + y) > min(a, b) \cdot max(x, y) $$$
Damn, that was simple...