Sunday, January 17, 2016

Break time : Starting my journey to Chennai tomorrow !!

Time for a break.

Not exactly, as I would still be solving algorithmic problems. But not from UVAoj. I would be leaving tomorrow from here for ACM ICPC Chennai regionals.

Guess what I didn't know a day back what I would be doing during all my journey. During an interaction with a junior, I realised the contest problems given for IITB internship are quite challenging. ( My definition of challenging is a problem that I can't think of a solution for in a few seconds )

So, yeah those are challenging. So, I would be spending my time with them only, and ofcourse how can one forget the Cormen book. And I guess these two are more than to make the journey lively.

See you all on the Republic Day of India.

Till then, ek break to banta hai yaar !

Saturday, January 16, 2016

UVA 10258 : Contest Scoreboard

This problem will always remind me how important it is to read the problem carefully. Very carefully. Most of the mistakes that I did could have been avoided, had I read the problem statement with patience.

Mistakes I did :
  1. I didn't read what was required in the output correctly. They asked for all those who have made a submission, I rather gave the output only for those contestants who made a correct submission.
  2. I didn't take care of the test case where the user will submit the correct output for the same problem more than once. I thought of it while starting to program, but then ignored it. Big mistake, indeed !

One mistake that I was going to do, was I didn't yet got what to do if user submits wrong answer after a correct submission. Guess what?! It was clearly mentioned what's needed to be done in the question itself. My first mistake saved me from this one.

I also learned a few new C++ features, namely, stable_sort, peek, get. I am yet to understand how to use stable_sort properly.

[5:57 PM] And yeah, I made another mistake just now. Foolish me!! Once again I have to say that I didn't read the problem properly because I missed the case that there is no penalty for unsolved problems. Damn it, it look a long time to correct this mistake.

I also got to know of stringstream, although I haven't used it yet.

Here is my solution for the same : https://github.com/ashwani-pandey/UVAoj-solutions/blob/master/10258.cpp

Thursday, January 14, 2016

Some more motivation for goals v2 !!

Ah, these second versions. I don't like to write them, but they do happen to be a reflection of the flaws in the previous version.

In my previous post, I talked of my desire to buy bean bags. I still do want them, but the point is the ones that are available in the nearby market right now aren't good enough for the price I might be paying.

Thus, it made me think of what might be more desirable than this. Seriously?! And then it hit me. I also really want to see many a television seasons, and what could be a better reward than this.

So, the goals remain the same as in the last post, but what changes is the prize money. Actually it's not money, you know. It's the first 3 seasons of Friends. Boom!! Boy, what more could you have asked for.

I thought for a moment to just go with prize of one season, but then if the work is so hard, then the prize should be a bigger one too. Isn't it so?

Now, what you are thinking and why the hell am I typing all this rubbish?! Just go, and get it, remember laughter is at stake this time.

Halla Bol !! 

Monday, January 11, 2016

Some more motivation for goals!!

Ah, I started with this "goal" thing two days back, and wohooo guess what?! I haven't studied a single thing in the past two days. Going really fast towards my goal, doesn't I. Shit man, I want to slap myself but I have got a better idea.

Actually today I went to the market to buy bean bags, and boy, I seriously want those. When I was trying those bags, this "awesome" idea struck my mind.

I want this, right. But how badly do I want this?! The answer is I wanted to get it packed at that very moment only. And the next question is what's the most important thing I need to do right now? Well, I know in my mind and ofcourse in my blood-pumping heart too, that I need to solve those three chapters of CP book before I start with a full-swing participation in coding competitions. Even my first goal is related to this : http://thisisashwanipandey.blogspot.in/2016/01/goal-1-moving-some-steps-forward-in.html

Huh, then I guess trade is simple. At least for me. Solve the three chapters : Data structures and libraries, Problem Solving Paradigms, and Graphs. And get ready to enjoy the comfort of bean bag.

I am going to do every thing that it takes to get it done now.

Halla Bol !



Saturday, January 9, 2016

Goal #1 : Moving some steps forward in competitive programming

Ah, this is one thing that I want to do the most, and I have delayed the most. So, no more delays.

The goal is simple : to solve the starred questions from the second chapter of the CP book by Steven Halim sir.

It's going to be awesome when you wake up excited to finish your task, and sleep thinking of your task. No more hassles or melodrama of making any schedule of what I will do when!!

Just adventure!! De Dana Dan Goal !



Resolution 2016 v2

Well, I wrote a resolution for myself a few days back here : http://thisisashwanipandey.blogspot.in/2016/01/resolution-2016.html.

Although it is a good one to have a healthy lifestyle, I didn't address the problem that haunted me the entire 2015. And that is : how I am going to improve my focus. Yes, this single word "focus" has been a trouble for too long now.

I need a solution now, right now.

And what I have found is that the best way to deal with the situation is to change the way I approach my work, rather than changing one of the so many daily tricks that I have applied to improve my focus.

If I change my approach towards work, focus will damn search for me itself.

What I have noticed is I have a long to-do list, a really long one with so many things to do that only I can imagine right now. And, what I do is I divide my daily time for a few activities, and my mind keeps on adding so many other stuff that I want to do in my daily activities.

Result?! I can't focus on any single thing, and nothing gets done, plus I feel sad that I did nothing.The quote fits quite perfectly here that you can dig a well only when you dig at the same place the whole day, instead of digging at so many points on the land. It will lead to no result.

So, what I am going to do now? From now on, I will write of a task, not-so-big and not-so-small, and will pursue that one only until I finish it to the level that gives me some satisfaction. And then only I will start with another task.

This will make me feel good as I could see my accomplishments, further boosting the energy in me to do more, rather than contemplating what time should I allot to which task.

Good luck, my boy. De Dana Dan Goal !

Monday, January 4, 2016

North-East earthquake experience on Jan 4, 2016 : The need for the practical education of disaster management

Ah, the second earthquake of my lifetime that I felt. And this one was powerful.

A few facts beforehand, I study in Silchar, and the epicenter of the 6.7 magnitude earthquake was just around 200 km away. That's why, as I said, it was powerful.

I was sleeping in my dorm room, but suddenly my eyes opened. I could feel myself shaking on the bed quite heavily. A distant light also seemed to be moving a lot. Microseconds later, I noticed voice of Pranav, my roomie, shouting of the earthquake, and so was the other roomie.

And I, without any sleepers and coat in this winter time hopelessly ran for the main gate. But is it all?!

No, that's not why I wrote this blog. I wrote it because I chose the worst possible path to escape the building. Had the building fallen, I was certainly going to be badly injured, in worst case, I won't be alive to write all my stupidity.

So, I ran thorough the narrow corridor of atleast 100 meters before reaching the main gate. And that was really too much, plus I didn't even consider that the building might fall.

What I could have done?! Well, firstly I should have waited beneath the table or bed till the earthquake stopped. I rather chose to run, as soon as I got to know it was an earthquake. That was the first stupidity.

Secondly, I ran more than 100 meters to reach the main gate. Guess what?! I have a balcony attached to my room, and my room is on ground floor. The safe zone was at most few meters away from me, but I rather foolishly chose the distant one, and that too this much.

All this made me accept that I am stupid, and foolish, and seriously a hell lot of foolish. But I feel it is good to accept all this and not to repeat the same hurried actions again, rather than repeat all this.

Remember, luck favors the bold !

Further, I noticed after the incident, that most of the students were just like me, stupid and ignorant, whether they accept it or not. This brings to attention the need to provide practical education of disaster management, to one and all.

We, as students, only learned the theory for this, and that too as a secondary subject. Not much importance is given to this subject, mainly to the practical aspects, in India. People sitting in the education ministry should take note of this, and I say all this with the Indian education in primary focus.

Till the next earthquake or any such natural disaster hits me, I would love to know more of what to do before, during and after such events, and I am surely going to know that, learn that, and be prepared, so that even if the luck choose to go against me the next time, I have my knowledge to keep me alive !




Sunday, January 3, 2016

UVA 11340 : Newspaper

 Ah, this question led me to learn new things, strangely.

It is pretty easy to implement this one, but I was getting WA. And then when I went on uDebug, I found this link : http://www.redgreencode.com/solving-uva-11340-in-java/  and I thought may be character encoding/decoding would be the reason I am stuck.

So, I read this article followed by another good article : http://www.joelonsoftware.com/articles/Unicode.html. I really enjoyed reading both of these articles. It's always great to learn something you don't know of, and I certainly didn't knew of unicode and all the stuff.

But alas, I still got a WA even after doing all the implementation corrections as mentioned in the articles. Later, I found out that the reason I am getting WA is because after finding the answer in cents, I was doing something as I have shown in the code uva11340-wrongway.cpp

You see the stupidity I was doing?! Well I was mixing up the strings with floating point values, and that's why all those WAs.

Simply the following has had to be done, as shown in the code uva11340-rightway.cpp!!


See if you have done some silly mistake like that, it was a big lesson that I learned today.


Friday, January 1, 2016

Resolution 2016

I always think of writing my resolution at the start of the year, but never really write it. May be that can be one resolution to do what you want to do.

But no, my resolution is something different. It's not related to what I want to become or anything of that sort, but rather what I want to do.

It's very simple.

I just want to wake up everyday from now on early in the morning, and go for a walk or run, and also not to sleep more than 7 hours on any given day.

Simple, isn't it?!

The adventure is in the next part. To be consistent. Don't miss the "everyday" that I mentioned in my resolution.

That's it. Yeah.

And yes, that's the only resolution I make this time. All the best.