Sunday, December 11, 2011

Act III, Scene 1: Goodbye Delhi, Hello Amrita

10th Dec, 2011.

I begin with our contest the night before – the final contest before the Amrita ICPC Regionals. We decided to have it at 9, and I had got my mom's guesthouse to book me a taxi from there to IIT after dinner. However, the taxi decided he'll make himself a bit late, and turned up himself at around 920. However, seemingly in penance for his lateness, he decided he'd drop me off at IIT as soon as possible, thus embarking on one of the most frightful drives I have ever been in. He wormed his way between traffic at high speeds – honking, accelerating, braking, and accelerating again; changing lanes while I sat behind swinging with the centrifugal forces and having my heart all the way up my throat.


After having dropped me at IIT at 930, I went to my room and decided to say a few late goodbyes to friends. They all were very oh-hi-how-are-you-now, what-are-you-doing-here, and other bouts of embracing and hand-shaking. In the end, I managed to extricate myself from there at 955, after having messaged Nikhil that I'd join 'em at 10, putting my batteries on for charging and getting back my pen-drive which I'd lent out before the end-semester exams.


As soon as I arrive at the gcl, Rudy says, 'Look at problems H, I, J...' A brief glance over H, and I announce that its brute-force simulation and definitely codeable. Rudy has a second look, I explain him what is required and how I would acquire it, and then sit down to code, only to realize that – wait, I have got the conditions down, but I have not got the step from one iteration to the next. Rudy then looks at it, and we start weighing different options, before he comes up with a simple, fairly elegant, and workable solution to the problem. Before he starts searching for a better more elegant method, I overrule him and tell him this'll work.


About 5 to 10 minutes later, we are sitting pretty on H solved as well. I look at problem I, work around with one vague idea, see it doesn't lead much anywhere, and then go to J. Now the problem J looked like a very slight modification of a standard algorithm, and after consulting with Rudy for a moment, we formulate a robust method of running. 10 minutes later, we have coded it, submitted it, and found it gave a TLE. As soon as we saw that, Rudy said, “Oh this is due to the negative cycles in the graph” and despite our efforts to work around it, we find ourselves hitting dead ends.


In the meanwhile, Nikhil has been working on problem B. He has working and working and has very nearly got it. There are a few bugs in his Java code, but otherwise, it would not take much time to get it working alright. With Rudy bearing down on the code, we get clear of all the bugs and make a submission: TLE. Seeing this, we try to convert the log(n) matching of the map to a O(1) matching of a hashmap. However, we are unsure of the syntax of writing hash functions and need to do a little research on it. After all this, we code it, and submit: Runtime Error.


By now, we are wondering what could it be, and we start trying various optimization approaches to help save our hide. Somewhere along the line, Rudradev says that maybe it is overusing Java's stack and causing an overflow error, that c++'s stack is much better and that we should shift to it.


Thus began one of our most strangest shifts from Java. We coded C++ pointers – something that we hadn't done since 12th std. except for a recent foray of Rudy and Nikhil in their placement interviews, and transpose the code line by line to C++. What manifests is a mountain of errors. Each attempt at clearing the errors seem to alert the compiler of newer classes of errors that it hadn't even bothered to check in the earlier compilation. What seemed like a battle against outnumbering forces, we fought our way through until it finally managed a compilation. Running the code on the sample gave no error, so we submit it. And get a TLE. Finally, we decide that we need to clear the pointers that we are using, and hence we do so. After a hesitant, “Should we submit?” we do so, and find ourselves shockingly surprised to get it AC. This turned out to be the Problem of this Year's Training, having us encompass knowledge of C++ pointers and memory allocation techniques which we have never had to resort to earlier.


In this spurt, we see a fractal problem, and after little discussion on displacement, distance, rotation and scaling, we set about coding it. The code is simple – straightforward, workable, and on the whole very doable. After a little while we run the code, and it gives us wrong answers. Fearing a change in our angles being of the wrong sign, we try other permutations of changing the signs of the angles involved to little effect. Finally, Rudy spots the error in the number of iterations of the fractal, and we find that it is now giving us perfect answers. We submit, and get it AC as well.


With just 5 minutes to go, we decide that okay, lets return to hostel and think over some problem on the way. So we discuss the problem I, where we have construct any non-intersecting polygon from n vertices. We discuss some basic strategies which we were trying to implement, but were failing on. One of which was, whenever we come across a segment intersection, we 'do a switch' so that the segments don't intersect. This somehow rang a bell with Nikhil, and he said, “Why don't we just go for TSP approximation? The bitonic path thing?” and me and Rudy look at each other and see that this is indeed good enough to give us our answer!


We reach back to our respective hostels at around 230; they go to Nil, and me to Jwala. I go to the night mess and order a Maggi, since it would be a long time since I would get it again – not that it is anything great or anything. After the Maggi, I go back up to my wing, and find blaring music of Alter Bridge's Open Your Eyes. Knowing only one person could be playing it, I go down to Raghu's room, and after he doesn't respond to my knocking, I start singing some of the lyrics from outside his room, at which point he opens it and we have our hi-byes. He says he needs some Fin Math notes and I give him whatever I have from my room.


Next is Gainda in his room; with Akash. We go there and find them just beginning to watch this Tarantino movie – True Romance (or something like that) and we sit down with them to watch it. After about 10 minutes or so though, I get a call saying that the taxi has arrived at Nil, and go to pack up by battery charger and everything and go.


The taxi arrived at around 315. We left IIT at around 330. We reached the airport before I could even close my eyes, at about 340. I remember commenting to Nikhil how I had set a timed message for 3:46 on my mobile to send to my mom that we were in the taxi, and about how it was ironic that it wasn't even 3:45 and we were already in the queue for the boarding pass!


At around this time, me and Rudy got into a discussion on Inheritance. We mainly covered the point that Eragon was Brom's son, and how people had speculated this from the first book, and how I had gotten clues and where I had gotten them from and everything. We discussed various aspects such as the Vault of Souls being a trove of Eldunari and other such fanciful theories about the final dragon egg which would have completely ticked off Nikhil, who was interested in getting the internet working and doing some coding.


We then decided we'd better get ourselves a bit considering we were unsure of doing so in the flight. So up to the food court we make our way, only to find that all the shops would open at 520, while our flight was at 555. At this time, I decided I couldn't stay awake any longer, and promptly put my head on the table and had a nap, while Rudy and Nikhil were if I am not mistaken, discussing a problem from the previous day's contest. I wake to find Nikhil gone to the toilet, while Rudy was saying that our boarding call has come with two trays of KFC food in front of him – for myself, him, and Nikhil. When Nikhil gets back, the 3 of us make our way down to the gate, with the food in our hands, virtually rushing since the call had already come while I was napping.


Our seats were right in the middle of the flight unfortunately. With the window view showing mainly the wings. Of the flight itself, there was hardly anything eventful, except for in the beginning during the sunrise Rudy pointed out the colours of the rainbow in all their vivid glory on the horizon and I began to wish that I'd had my camera in my hand baggage instead of checking it in. We had a talkative pilot on our way to Mumbai, who began telling us how happy he was to have us on the flight, that we were over Jaipur, and that this was the first time his dad was traveling in the flight piloted by him, his son. Of most of the remainder of the journey, I fell into a deep sleep, with my mouth wide open and my legs wide open and my knees jutting into the aisle due to the leg space being cramped in front by the laid back seats of the people ahead.


Apart from a few spurs of wakefulness during the journey, I finally woke up about an hour before landing in Kochi. We were then flying over Mangalore and the pilot there made note of that fact to us. It was then that me and Nikhil got into a discussion about writing techniques and stuff and he showed me this book by Ursula Le Guin about how to write with all its exercises and everything. I looked at it, and went straight to the chapter on POV having George RR Martin's Song of Ice and Fire series in mind. We discussed various aspects of Nikhil's story, that he'd sent it to his English teacher who spotted the Machiavellian in the narrator while the rest of us could not, and about using a different POV for the same situation and what would it entail to the reaction of the reader.


The flight took off early, and landed even earlier. We found ourselves waiting just outside the airport for our pickup. The corridor was long at the other end there was a crowd, so I thought that maybe he'd be there. However when reaching there, I found that was the departure gate, and I found it indeed funny that there would a crowd of people waiting outside the departure gate peering inside while the arrival gate was empty except for people from previous flights waiting outside for their own respective pickups.


When our pickup did arrive, we bundled ourselves in, and found that we barely had enough space for the three of us and our luggage. Then the volunteer who came and picked us up told us that we'd be picking up another team of 2 from IIT Bombay! In any case, we managed to squeeze here and there and adjust ourselves as best we could before stopping for lunch. Here Rudy and me had masala dosa, while Nikhil had a biriyani, and after that we topped it off with good ol' South Indian hot coffee. The rest of the journey took about 3 hours and was a bit more comfortable, and we landed up at the accommodation at around 3.


After relaxing in the room for a little bit of a while, we decide to go and find the main building and explore the old haunts. There we bump into Vallath Nandakumar, the Regional Director and we discuss various things like the ICPC Committee arriving for the event, that India would be bidding for a chance to host the World Finals some time, and a slight look at our possible competition from the site.


On the way back from the main building, we stopped at Amma (restaurant) and picked up some snacks consisting of a Lays, some biscuits and a Mirinda. After getting back to our room, we start munching on our snacks while simultaneously discussing another problem from the contest. After making much headway into it from various directions we find ourselves slightly stuck yet at the same time with somewhat a good solution in hand. Later Nikhil checks the official solutions and finds that it is one of the approaches that we had discussed.


At around 6, with about 2 hours to go for dinner, we decide to watch a movie. So taking Nikhil's external, we browse through the movies, stopping at one Fever Pitch which seemed nice it had a school environment in it somewhere. It was not a great movie, by far. But considering that it was about football fandom, and that I could not relate to it, makes me feel like I do not have the right to judge its merit as a movie. After the movie we went for dinner and registration, only to find that it had closed. Post dinner, we are too tired to do anything. I talk to Sandeep over the phone about his upcoming interview for nearly half and hour, and then decide to write this and sleep.

2 comments:

  1. HacKitT, still to come. Act I is incomplete, so I didn't publish the (only) scene of Act II. But between writing up the completion of Act I and the publishing of Act II, I thought it better to publish Act III in real time.
    Act I has atleast one scene left (to be written) and Act II has one scene to be published. Stay tuned...

    ReplyDelete