Bengal_Tiger's blog

By Bengal_Tiger, history, 4 months ago, In English

As a programmer, there have been countless times when I felt like giving up during my contest practice days. The frustration of not solving a problem or facing unexpected challenges can sometimes be overwhelming. During these tough moments, I found solace and strength in simple yet powerful motivational quotes.

These quotes were not just words; they were a source of energy that kept me going, pushing me to strive harder and not give up. Here are a few quotes that have profoundly impacted me:

"Success is not final, failure is not fatal: It is the courage to continue that counts." – Winston Churchill

"The only way to do great work is to love what you do." – Steve Jobs

"Don't watch the clock; do what it does. Keep going." – Sam Levenson

These quotes reminded me that every challenge is an opportunity to learn and grow. They helped me stay focused, keep pushing through difficult times, and eventually achieve success in my coding journey.

If you're looking for more motivational quotes to keep you inspired, I've compiled a collection on my website Inspiring Quotes You'll find not only motivational quotes but also quotes on various other topics that might resonate with you during your coding practice or any other challenges you face.

Remember, it's the small things, like a few words of encouragement, that can make a big difference. Keep coding, keep pushing, and most importantly, never give up!

Full text and comments »

  • Vote: I like it
  • -20
  • Vote: I do not like it

By Bengal_Tiger, 6 years ago, In English

I have solved the popular xor maximization problem XMAX — XOR Maximization using gaussian elimination . [problem statement : Given a set of integers S = { a1, a2, a3, ... a|S| }, we define a function X on S as follows: X( S ) = a1 ^ a2 ^ a3 ^ ... ^ a|S|. Given a set of N integers, compute the maximum of the X-function over all the subsets of the given starting set.]

But when applying same code in XOR with Subset from codechef, it gets WA.

[**problem statement** : You have an array of integers A1, A2, ..., AN. The function F(P), where P is a subset of A, is defined as the XOR (represented by the symbol ⊕) of all the integers present in the subset. If P is empty, then F(P)=0.

Given an integer K, what is the maximum value of K ⊕ F(P), over all possible subsets P of A? ]

the only change i made is initialize answer = k. than after using gaussian elimination , i greedily checked if taking it increase answer.

My code : Link

can anyone please tell me whats getting wrong.

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it