I am doing the same thing here: CodeChef: Practical coding for everyone I just changed the last for loop of my XMAX solution but it gives WA
Also, what is then wrong with the following approach CodeChef: Practical coding for everyone , itās doing the same thing by just dividing the input set in two different sets as explained in my answer below.
@damn_me,upvote my comment!!!
U are correct,Your logics are absolutly correct.
Just scratch your mind on your codes once again
You are pushing everything into vector.How can it be possible??!!!
vec.clear()!!!
@rudra_sarraf Thanks a lot, seems u needed an upvote But what is then wrong with this: CodeChef: Practical coding for everyone
@damn_me,What I said was Just scratch your mind on your codes once again
But u didnāt!!!
Declaring a variable twice gives error.(ll row=0)(Always try to write clean codes.)
This time no more bullshit neither I need more upvotes than I deserve!!so,
http://www.codechef.com/viewsolution/5609023
If you find clear proof of analogy of gauss elimination method=>Then kindly comment the link (other than mathematics stack exchange=>maximization of xor operator!!).
At last but not the least=>actually (2 upvotes>1upvote)!!!
@rudra_sarraf I have already got AC on this logic. First open the code or link I have mentioned in my comment carefully and then say!! I think discussion forums are for help people want to do themselves and no one is forcing you to see someoneās problems or errors. So better not use any more harsh words here!!! And also, I was just joking for that upvote thing.
Once again=>Declaring a variable twice gives error.( you have declared ll row=0 twice!!)
Is that harsh??? OOPS!!
And do you really think that I was taking your joke seriously!!!(just go on thinking blah blahā¦)
Just skip itā¦(Otherwise you may complain to admin!!!)
Donāt take anything about k into consideration and apply the algorithm as stated by llmari Karonen on stackexchange.
The only difference to be made is in maximum finding algorithm is to initialize max to k instead of 0.
Check your solution link! Its bytelandian gold coin problem.
Explain your logic step by step or write well commented solution at least.
This man is a genius.
@chaitan94
About your Gaussian Elimination soulution: CodeChef: Practical coding for everyone
The logic is correct. But there is small flaw in implementation. The above code will give wrong output for following test case
1
3 1
12 10 8
This is because of how STL set works. For correct result, just swap these two statements
s.erase(t);
s.insert(t^m);
Where else can we use gaussian elimination technique other than this example and the traditional example of solving linear equation?
Where else can we use gaussian elimination technique other than this example and the traditional example of solving linear equation?
Numbers up to 1000 have powers of 2 up to 9 in their binary representation (2^9 = 512).
Hence, the xor of these numbers is at most ā1111111111ā, i.e. 2^0 + 2^1 + ā¦ + 2^9 = 1023.
sorry, Iām forget to add the word efficiently.
Oh! So the xor basis reduction trick is actually called gaussian elimination , I never knew that. I did the same for my solution, but itās not too popular huh. I havenāt seen tutorials on XOR G.E., so it might be good to cook up a good tutorial on it in the future.
Hi, Can somebody explain why this approach is incorrect?
Since N was small, I used this approach.
https://www.codechef.com/viewsolution/24737767
I solved this problem with a dp[1024] and finding all possible elements formedā¦
but this approach is failing in a single test caseā¦
This is my code.
https://www.codechef.com/viewsolution/24874644