Hey all,

I have planned to code for 5 hours straight. I am not going to develop this time. The Plan is to solve medium-hard level SPOJ problems. The initial target was to solve 10 problems, but then I feel I am overestimating myself. Solving 10 problems in 5 hours can be bit far fetched to me. So decided to solve 5 problems in the end.

These are the problems I have picked for solving just by sorting SPOJ problems based on quality.

What am I looking forward to at the end of this code-a-thon? The aim is to learn and improve problems solving. I don’t get time to learn new concepts, this coding extravaganza is a good opportunity to learn. So you see, the aim is TO LEARN AND IMPROVE.

Coding starts by 5 am and end at 10 am. Starting at this early hour is also a challenge to me. I haven’t done that before too. I will be simultaneously updating here at my blog. Just updates like my insights on the problem and stuff like that.

Good night guys! I am already excited, can’t wait for tomorrow. Wish me luck and Happy coding!

Thanking you,

Aakash Chandrasekaran

Edit

- [5:13 am] Good morning! Without any delay let’s head to solve the first problem. AGGRESSIVE COWS.
- [5:35 am] Was trying out my luck in binary searching for the largest minimum distance. But I was not able to prove the existence of solutions for the set {1,2,3,…,d-1} if the hypothesis is true for d. You know what I do I need the most to crack now? Coffee.
- [6: 00 am] Binary searching over d can never lead to a solution. I just convinced myself because of this peculiar example.
`x = {1,5,7,9,14} has got a solution for d = 4(Cows at positions 5,9,14) but there is no solution for d = 3.`

I should find a different approach to crack this problem. - [6: 16 am] Let me take a coffee break.
- [6: 41 am] Let’s come back to aggressive cows later. Let me just solve the HORRIBLE QUERIES. I think it is just plain segment tree with lazy propagation. Complexity : Tree construction –
`O(n)`

, Queries =`O(C*logn)`

- [9:04 am] Successful submission of HORRIBLE QUERIES :D. Took me a while to grasp the concept of lazy propagation.
- [9:22 am] Moving ahead to PARTY SCHEDULE. Easy 0-1 Knapsack problem. AC!:D
- [10:00 am] Time is up! I can solve two problems out of 5. I’ll upsolve them and will make a write up here again. Thank you!