Thursday, 1 July 2021

Qualifying for ICPC World Finals 2020 - An experience (Part 3 - Training for Amritapuri Regionals)

We said bye to Shriram, as he was going back home for now. Tushar and I headed over to my home, where he would be staying for the rest of December, as Amritapuri regionals was right after Christmas.

Cheers everyone, I'm back with the 3rd part in this 4-part series! This post will cover our training and experience uptil the end of Amritapuri regionals, with the Asia West finals to be covered in part 4. I realize I'm writing this over a year since the last blogpost, but there are some reasons for this I will talk about elsewhere. Anyway - with the regionals for ICPC 2021 coming up next month, it seems like the perfect time to finish what I promised! :)

After the Kharagpur regionals, it was clear that we had an outside shot at making the World Finals, no matter how outside the shot really was. We started solving problems on the train right from the way back from Kharagpur, to make up for the lost practice in the previous months. Even though we did not know much theory relative to the other top teams, with practice rounds we realized that our performance often suffered not because of some algorithm that we did not know (although this was sometimes the case), but more often because we had not seen some trick or had implementation problems in some question.

Thus, when Tushar and I got home, we decided to do something like an ICPC-type practice contest a day. Moreover, my parents had to leave us home alone due to exigent circumstances, and with no distractions, we had the ideal environment for practice.

Due to our sleep cycles not syncing up (at all), we decided on doing only about 1 contest a day as a team, and the rest of the time was spent in reading the editorials and pursuing other pass-times/hobbies. I had a conference to attend to in the middle of December as well (FSTTCS - I had a great experience there, as it was my first theoretical CS conference!), but that's for another time.

Both of us decided to give the Pune-Gwalior replay contest together on a single laptop, to simulate how we would perform on a regional. We got off to a very bad start, getting multiple WAs on easy problems and then in the 3rd-4th hour misreading and mis-solving DICITIES about 3 times, re-writing the code each time. We ended up with 8 problems solved, with me having almost coded the 9th, whose idea turned out to be correct. We were surprised to see that 9 problems would be good for clear 2nd place, with IIT Kanpur solving 10 problems and IIIT-Delhi solving 8. It seemed like we had hope at Amrita, where both of these teams would not be participating. 

In a few days, Shriram joined us, and we gave a few more team contests. Results were not very consistent, with us doing really well sometimes and getting stuck on something we needed to overcome (by, for eg, skipping problems or implementation practice) other times. Soon, it was time to leave for Bangalore. We were confident that we could do okay, but winning still seemed like a distant dream.

At the Bangalore train station, we were picked up by volunteers from the Amrita school of engineering. We left in a bus, reaching the school in about an hour. The Bangalore campus seemed to be much smaller than the Amritapuri campus, but just as lively! There was a large ground in which people were playing, and multiple canteens/eateries, etc. We made our way to our accommodations, and after settling down, immediately began looking for places to eat - we were a team of gluttons, after all! 

During and after lunch, we made friends with a few teams around us. Most of all, I was excited to meet the people beyond the handles I'd been talking to for the past year on my computer screen - for example, aryanc403, Taran_1407, and Ashishgup. There was to be an outing in the evening, so I decided to go, and sent a message to all of them to come to the trip - we could finally meet each other there! Turns out Ashish was busy with other work, so I, Aryan and Taranpreet went on the trip with various other teams. While Aryan and I got on the first bus, Taranpreet followed us on the next. There were many people missing, possibly because they were working on their preparations or team notebooks. Both my teammates decided not to come as well, as it was a trip to a local garden. 

Our bus ended up arriving early, so I and Aryan started looking around. It was already close to 4 pm, which meant it was time for another meal :P. We started looking around for eateries, and found one close to where we were - and we had a light meal there, before heading to the garden. It seemed that all the teams had split into their own clusters, with teams from a single institute banding together. Since none of us had teammates, we decided to talk to as many different people as we could! We ended up talking to a bunch of different people, asking about their ICPC experiences and future plans. One of these interesting conversations was with the teams from IIT-BHU, who had multiple strong teams, with one of them barely missing WF the previous year. IIIT-D had many teams on the trip as well, who were playing some games among themselves. We decided to snap a picture as a commemorative photo of our first meeting, and ended up posting it on social media with the clever caption "2 Gods and 1 Noob(?)"
, in the hopes of torturing some curious souls as to the identity of the "Noob" among us. (Yes, we did the imposter thing before it was cool :P). We added the hashtag #NotMyICPCTeam, as a play on the hashtag #MyICPCTeam which was supposed to trend. 

From left to right: Aryan, me, Taranpreet

As is tradition, there was a feast in the evening to celebrate the event itself. And fittingly, as is tradition, there was some tension in the air, with the big contest coming up next morning! We ate dinner quickly, and went back to revise some ideas that we hadn't had time to look at before. Right from various Combinatorial games such as Hackenbush to some Jacobi symbol properties and group theory, we nervously rushed through a lot of content until we decided it was better to sleep and conserve our energy. No team is free from nerves, it seems. During this time, we also made friends with the neighbouring teams in our dorm, who had also been in the Kharagpur regionals.

We rose early on the day of the contest, with me having a restless sleep as is usual when I'm nervous. After getting ready quickly (so that I could come back and wake the others), I realized yet again that there was no need to wake my teammates, especially today. Everybody was taking this seriously - they were already up, despite all of us having a habit of sleeping in whenever possible. We got ready significantly early, and this time, we didn't make the mistakes from our previous regionals - I made sure to shave, since last time I had sworn it was the reason we hadn't won! Moreover, we decided to spend 30 minutes dancing to K-pop songs (read this for the reference) - we were not taking any chances when it came to winning. 

ICPC Amritapuri Regionals 2019 

The above contest can be found here. The live commentary blog can be found here, but I recommend you see it after reading this blog. I also highly recommend giving the contest on your own before reading the below - it contains heavy spoilers, as you would expect.

With our hearts in our mouths, we headed to the regional area, and sat down at our computer. As is standard, there was a small delay with the regional starting time. I quickly started typing our template out, while Tushar was looking over my shoulder and reading lines from our template that I should add. Finally, everything was in place and the contest started.

I found myself in front of the keyboard, as is usual in the starting hour for our team - having the best typing and comprehension speed, I usually got the easy problems out of the way quickly. This time, it was clear the easiest problem was USANBOLT - being something like a div2A, I quickly coded it and got AC. Having spent a few seconds making sure everything was typecasted correctly and there were no issues, we were definitely not the first AC this time, unlike the previous contest. Meanwhile, Shriram got the solution to SDIFFSTR and Tushar was looking at EXPCAN. I started looking at the other problems.

Shriram coded up SDIFFSTR, which was an easy Div2A-level problem that has a greedy solution. After Shriram got AC, Tushar coded up EXPCAN while I and Shriram discussed COLPOLLY, which I thought was the next easiest problem. I had the strong intuition that a very small number of colours is necessary, and we come to the conclusion that 3 is enough, since you can triangulate the graph. However, how to get this colouring? I proposed starting from a random node and giving colours iteratively - we agreed to try this, since it seemed that if the solution wasn't this, then we need to find the triangles, which will take us more than 20 minutes anyway - so the penalty is fine. Tushar got WA, printed his solution, and I took over and coded this solution to COLPOLLY. It got WA, and meanwhile Tushar and Shriram figured out the mistake in his solution to EXPCAN. He proceeded to fix the code, and was rewarded with a shining AC. Actually, his solution to EXPCAN is interesting - the problem's constraints allow an n^2 solution to pass, but we can do it in O(n). The main observation to solve it in O(n) is that states which are "unbalanced" in terms of the number of elements removed from the left and right (for eg, 30 elements removed from the left and 70 from the right) have very low probabilities of occurring. I couldn't find anyone who had already submitted this solution on Codechef, so I added my code for this idea here. This idea is not that easy and probably is already worth about a Div 2D-E rating; however, since the original problem did not require this, it is only about a Div 2C.

Meanwhile, I had started looking at other problems, since we got WA in COLPOLLY. To be specific, I believed COLINT and MORTAGE looked doable. Meanwhile, Shriram explained to Tushar the idea about atmost 3 colours in COLPOLLY, and I came up with a counter example to the original algorithm. We knew the actual algorithm for this would be just to write down the triangles and solve it iteratively, which would be a little painful to code. However, Tushar almost immediately claimed that a priority queue where you choose nodes with highest number of assigned nodes as neighbours will work. In a few minutes, he is convinced this is correct. Since this is much easier to code, we let him type it out. Meanwhile, I am convinced that COLINT has a greedy solution. 

Tushar surprisingly got AC on COLPOLLY, and we were stunned for a moment! No other team had done that problem so far, whereas all other problems had been done by more than 1 team - hence, we had an "advantage" in that we had to catch up on the easier problems. I told Tushar my greedy solution on COLINT, and he was unconvinced. However, I believed I had a proof, and my teammates just decided to trust me on it and let me code it. I coded it up quickly and we get AC. So, we had about 5 ACs in slightly more than an hour. From this point on the problems were harder, and hence we took more time on each problem. 

I and Tushar discussed MORTGAGE for a bit, and I told him to leave it to me. He and Shriram discuss TRGRPH and POLCON. At this point in time, MORTGAGE was the problem we had't done which has been done by some teams. I thought about it for some time, and soon I had a solution which could be proved via exchange arguments, which we had looked at recently. I told Tushar about it and he was again unconvinced - he is a bit skeptical about greedy algorithms in general!

I did believe it was correct though, and I started coding it. The nervousness of being close to the top of the ranklist got to me a bit, and as a result I was a bit slow at writing the code, wanting to not make any mistakes. The solution to this problem involves a binary search, followed by a greedy idea. I used a fixed epsilon, and stopped whenever the absolute error is smaller than epsilon (which as we will learn soon, is a very bad idea!).

Meanwhile, Tushar and Shriram had gotten a solution to TRGRAPH. I submitted MORTGAGE after finishing my code, and we received our second WA at the contest. Surprised, I printed the code quickly and gave up the computer so that they could code up TRGRAPH. I looked at my code, and was unable to find any mistakes as such. I asked Shriram to go over my code, and he found a mistake in one of my loops - I had not handled one of the edge cases correctly. I took over the computer for a bit, fixed this bug, and resubmitted. Only to receive a TLE!

At this point, we were a bit tilted because MORTGAGE had been solved by several other teams, and although we are the only ones who have solved COLPOLLY, we could feel the lead slipping away. Moreover, a Codechef representative came up to us, and told us that our solution to COLPOLLY may be wrong - and we may be hacked as they might add testcases between the contest, to make our solution fail! Meanwhile, Tushar looked over my MORTGAGE code for a bit, and quickly noticed my epsilon idiocy - it is much better in general to use a fixed number of iterations, especially when both absolute and relative error are involved. To be safe, he also rewrote some more of my code such as fast exponentiation to be iterative instead of recursive. He finally pressed the "Submit" button, to get another WA! This felt like the ultimate disaster.

We started looking at other problems, while rotating looking for mistakes in the code of MORTGAGE in the three of us. Tushar finally got AC on TRGRAPH, and he and Shriram realized that POLCON is just a direct application of Dilworth's theorem of maximal anti-chains. Tushar told me this, while Shriram looked at PERMDIST. I coded up the geometry part, only to realize that I made a mistake the previous night. We had decided that we should add "check if a point is inside a convex polygon in O(logN)" to our notebook, but it being late at night before the contest, I just decided to add the pseudo-code in our notebook, thinking that on the off-chance it appeared in the contest, we could reproduce it. Now, we are looking at a problem with n = 100, where we need to find whether n convex polygons are pairwise within each other or not, and the convex polygon algorithm brings the complexity down to O(n^3logn) from O(n^4). We lamented this for a bit, before deciding just to write the O(n^4) and pray to god that it passes.

...And of course, it got TLE, because what can go wrong does go wrong, doesn't it?

Tushar looked over the code, and saw a couple of places where early exits could be added, and resubmitted immediately before we could tell him he wrote a bug while we were looking on. So, we had another immediate resubmit after fixing that bug, and finally the code passes! That was lucky. Later, we learned that it was possible to solve this in O(n^3) by simply creating the convex hull of pairwise 2 polygons, and checking if it is one of the polygons. 

At this point, other teams had started getting ACs on COLPOLLY. We had to figure out the mistake on MORTGAGE - fast, if we wanted to have even an outside shot of winning. I started looking at PERMDIST again, since I had solved a similar problem before, but there were still some significant differences. Tushar looked at MOBCNT - I quickly decided that LALALANT is not worth looking at, and we just threw the problem away (it is way too case-worky). With the 4-hour mark close by, Shriram finally noticed a bug in MORTGAGE - when Tushar had changed my fast exponentiation to iterative, he ended up writing (x>>1) instead of (x<<1) - which meant x was being divided by 2 instead of multiplied by 2. Thus, we almost threw away our whole contest on just a stupid mistake of opposite operators! How frustrating. Finally, after 7 wrong attempts and with the time on the clock as 3:47, we got AC on MORTGAGE. Around this time, a representative from Codechef came and told us that our solution to COLPOLLY was no longer being considered for hacking, and it would be considered as AC. (Later, in the solution session they said that "some team" had submitted it and they managed to prove it by looking at some papers).

We were 3rd in the ranklist - the top 2 teams being "AlwaysReadyToOverkill" from IIT Delhi and "Laila" from IIT Roorkee, with all of us being tied on 8 problems, and the 4th team having 7 problems with a small penalty. We were sure that the other teams would do atleast one problem, since they had about 90 minutes from their last AC to do a problem. Because our penalty was so bad, we needed to do 2 problems to have a shot at winning. We hunkered down and got to business. I started looking at COMPLEXG and started getting ideas, while Tushar got the idea for MOBCNT. After discussing with Shriram, he was convinced he had the correct idea, and started coding it immediately. Miraculously, within about 15 minutes, Tushar got AC on his first try! Thus, with about 55 minutes left, we had to do one more problem to have a shot at winning.

None of us got any ideas on PERMDIST, so we decided to focus on COMPLEXG completely. I had gotten the idea that we could represent everything in terms of directions, which was also independently reached by my other teammates when they had seen the problem. Thus, it was clear how to solve the problem with DP when the graph was a DAG. Tushar started coding this part, while we watched and continued to think about how to solve the problem when the graph is a general directed graph. During this point, a representative from Codechef decided to come by and take a picture of the "top teams" for their Twitter page, and he alerted us and told us to smile at the camera. It is my personal opinion that such things should be done with minimal disturbances to the contestants - what if we had missed ACing this problem by a few seconds (a very real possibility)? Obviously, Codechef would not have taken responsibility, and we would have been robbed of a World Finals opportunity. Either way, we were unable to figure out how to fix the issues for general directed graphs by making the SCC graph in time, and we resigned ourselves to our fate of 9 problems. I am attaching another photo CC had taken below (the one where we are looking at the camera was ugly, partly because we were nervous wrecks). 

A picture taken by a CC representative


 After the end of the contest, we were left with the bittersweet taste of defeat in our mouths. We were sure that the teams "Laila" and "AlwaysReadyToOverkill", which were the top 2 teams before the ranklist froze (we were third, all three tied on 8 problems) had done atleast one more problem in the final hour, and we had an absolutely terrible penalty because of our 7 WAs on MORTGAGE.

To confirm our fears, we decided to ask all the top teams about their performance as soon as possible, to confirm our loss. The first team to ask was the team "Hold Right There Sparky!" from IIT Roorkee, who were just 2 rows diagonally ahead of us in the contest hall (since Amrita is a big regional, even in just the Bangalore site there were something like 3-4 halls). 

..and it turned out that Hold Right Sparky had done 9 problems! One thing I notice about this team is that they are very "clutch" - they tend to not do that well in the first 3-4 hours, and then go on an absolute tear in the final hour. In Amrita, they had I believe 7 problems when the ranklist froze, and they jumped to 9. Either way, we decided to quickly compute our penalty to confirm our worst fears and begin the coping process. However, it turned out by our calculations that... we were a little bit better on penalty! Their teammate said they were slightly better, but after a more detailed investigation we found out that we indeed had a slightly better penalty. We felt this was just prolonging the suffering at that point.

Hold Right There Sparky found out that Laila ended up with 8 problems, failing to do anything in the last hour... and suddenly, there was hope. Did everyone really brick everything in the last hour? Was it possible?

We tried looking for the team "AlwaysReadyToOverkill", but were unable to find them anywhere. In the lunch area, Aryan told us they were only able to do 8 problems! We were stunned, and afraid to believe only to be let down. We started realising we might have won the whole thing - however, it wasn't done till it was done. There might have well been another team like Hold Right There Sparky, which could have gotten 2-3 problems in the final hour due to our high number of penalties.

After talking with the teams who had lesser penalty than Hold Right There Sparky on 7 problems, we started realizing that they had been unable to do 9 either. Moreover, we realised that not many teams could overtake us since we got COLPOLLY extremely quickly in comparison to other teams! With bated breath, barely able to hold our excitement, we went to the prize distribution ceremony. Tushar had a train immediately after, but he was willing to cut it close for the possible moment of glory. And soon, starting from the ICPC for schools prizes and so on, we started counting down the top 10 teams at ICPC Amrita. Most of them were strong teams whom I recognised as top competitors in the country. We were just praying to not hear our name until the very end. Soon, rank 3 was announced as "AlwaysReadyToOverkill" with 8 problems, and rank 2 was announced as..... "HoldRightThereSparky" with 9 problems! With a sigh of relief, we walked up to the stage in disbelief as we finally lifted the trophy, only seen before in our dreams. If you had told me in the morning that this would actually happen, I would have called you a crackpot. As the cards were dealt, it actually happened and it was an unbelievable moment. We were congratulated by many of our friends and some strangers on winning. Unfortunately, Tushar had to leave, but the rest of us decided to have a fun evening, and since we were (persistently) pestered for a party, we decided to oblige.

In the evening, everyone gathered and out of the people invited, exactly 10 of us decided to go: Me and Shriram from our team, Taranpreet Singh, Udit Sanghi, Aryan's team (Aryan, Umang and Abhay) and Jeel's team (Jeel, Sparsh and Ashish). Since we were really feeling like doing something fun, we decided to play laser tag at a close-by game centre. On with the games!

It turned out that laser tag had a long waiting time of about an hour, so we bought tickets and decided to have dinner somewhere while waiting. It turned out that a decent restaurant was on the 2nd floor of the game center, and so we decided to have dinner (consisting of noodles, pizza and pasta, of course - what did you expect a bunch of teenagers to eat?) there. We had a fun time, with everyone talking about their ICPC experiences, what they were doing and planned to do ahead, and laughing and making jokes in general. Although it was my first time meeting all of these people, I had interacted with them online and it was great to meet up and party like this.

Finally, we moved on to the actual laser tag game, right on time. We were divided into two teams, and put into a maze. We had to score points by shooting the opposing team's people at certain positions (a target was placed at various places on each person's body) to gain points. There were also targets around the maze which granted points, including each team having a "main target" they had to protect, which gave much more points than the normal ones.

At the start, my team went with a conservative approach, guarding the target and prioritizing personal safety (you would get timed out for a bit if you were shot) over scoring points quickly. However, as some members of the opposing team started using more aggressive approaches, beating our defenders and heading to our goal target, we started becoming more brazen in our attack as well. After a point, it became pretty much about quick instincts and precise shooting rather than smart play and hiding. As expected, in real life I am as bad at shooting games as I am on PC games, and hence I ended up nearly at the bottom of my team's scorecard in terms of points. However, our team ended up winning, since all of us contributed a good amount of points to slightly edge out the opposing team. Meanwhile, Umang carried the opposing team, racking up a monstrous score and the individual highest!

After this fun activity, we head back to our dorms where we decide to play cards and stay awake all night, as many people have flights early in the morning. Naturally, my room was chosen as the target, as Tushar had already left, and various beds are brought in from other rooms to make space for a larger gathering. We were joined by our friends from BITS Pilani (aka Ashishgup and friends). We ended up making a huge racket, and the security guard literally runs to catch us red-handed making noise. We get warned a couple of times about making too much noise as the other students are trying to sleep, and soon we became smarter in our ways of making noise.

We started placing someone closer to the door to warn us if he sees the guard on his rounds, as well as moved a bit farther from the door and made louder noises only at periodic intervals to pass under the radar. We still got called out about 5 more times, but as more and more people left for their flights and trains, we start to change the games to dumb charades and so on until Shriram left and I decided to get some sleep. We finally disbanded, and I fell asleep on the floor with a pillow under my head, exhausted by all that happened and still in a bit of disbelief - just hoping that it wasn't all a dream. I woke up a little past 12, and posted an Instagram status asking if anyone wanted to meet in Bangalore. 

After freshening myself up a bit, I saw that a friend had replied, so I went to the mall to meet her and spend some time hanging out. She told me a bit about the area, and I left early because I was excited to meet a PhD student I had been working with on a cool project for a while, who works at DRDO Bangalore. I packed my bags and headed to their place, and I wound up staying there for dinner while meeting his wonderful wife and son, who made my visit memorable. We also discussed some research ideas, and soon after this visit 3 papers from our research group get accepted - perhaps this visit was super lucky somehow (yay!).

Finally, I left for Bangalore airport in a bus - apparently, Bangalore airport is far outside the city, so it takes more than an hour (possibly 2) to reach. Having some time to myself, I finally reflected on our performance at ICPC Amrita. I feel like Tushar with his quick solution of MOBCNT and Shriram with the quick 3 colour COLPOLLY idea had their standout moments. I knew I could do better - I decided to view Asia West regionals as a chance to do my best. Moreover, while all 3 of us decided to take a break from programming for a while - practice had really been tiring, and we were saturated - we also realized that our win in Amrita was somewhat influenced by a bit of luck, not solving any problem that was significantly hard but still winning. Thus, Asia West was a place to prove, once more, that we as a team deserved to qualify for the World Finals. With these positive thoughts in my mind, I got on my flight and looked forward to a week-long break...

Thursday, 23 April 2020

Qualifying for ICPC World Finals 2020 - An experience (Part 2 - Road to Kharagpur regionals)

After the confirmation of qualifying for our 2 regionals, we breathed a sigh of relief - which was surprisingly short-lived. This was the perennial "calm before the storm".

Hello everyone, I'm back with the second part of this 4-part series. This will be significantly longer than the last post, as there are a lot more things to describe here. So, let's get right into it!

After the qualification round, we had vowed to practice more for the upcoming regionals - we knew we had a chance, however slight, of actually qualifying for WF. However, there were some changes in the WF selection criteria this year. You could go to upto 2 regionals out of 4, and only the top team from each regional would be selected. Around 40 top teams in total would be invited to Asia West as well, to decide the Asia West champions and also to offer additional WF slots.

We came to know about these changes before applying for regionals, and accordingly we choose Kharagpur and Amritapuri regionals - Kharagpur because it was the weakest field of any regional according to the people who were planning to attend, and Amritapuri in case we did badly in the online round, since with good probability they will choose teams on merit. Thus, it turned out that our first regional was Kharagpur, to be held on 7th December.

It turned out that all 3 of us had sufficiently different schedules such that we usually had practice sessions available only from 10pm - 3am, and post-contest discussions from 3am - 5 or 6am, and thus it turns out that I missed some classes in the morning because of these sessions (you win some, you lose some, I guess). We started getting good results around the start of November, winning an old regional by solving all the problems in the 5th hour, and placing top 3 on a few other regionals as well. We started believing that we might have a fighting chance this year.

However, exam time was soon upon us in late November, and we temporarily stopped team practice completely. After the end of exams, Shriram and Tushar were somehow able to arrange temporary accomodations in their hostels, and with me living at home in Mumbai, we continued to practice in IIT-B itself until the time came to leave for Kharagpur.

NERC 2019-20 finals

Note: Contest analysis ahead. Try the problems in this contest here yourself before you read the following.

The above contest was a morale boost for us, as we performed quite well here. We were also using the contest environment by this point in all our contests, which meant - no pre-written code, and a single laptop for writing code. Actually, what we did is - only one person would write code on their laptop, while the others could only use their laptops for looking at code (basically the same as on-paper debugging).

Here is a short discussion of the above contest:

After the start of the contest, I started coding B immediately, as it was a cakewalk problem. I got a WA, and asked someone to look over my code. We found one error, and I submitted again, to get WA. Meanwhile, Shriram took over and started coding E, while I looked over my B and Tushar went over the other problems. I found my error, changed it and got AC, and in the next minute Shriram submitted as well, and we had 2 ACs in 32 minutes. This was an extremely slow start to the contest, and we were already behind.

Tushar got the idea for L and started coding it, while me and Shriram spent a good amount of time looking at K. I remember that I overcomplicated the problem a lot, using some dp ideas for number of matchings to get some idea which did not fit in the time limit. Meanwhile, Tushar failed on L and Shriram decided to help him debug. I started looking at other problems since I was unable to proceed on K. I got the idea for A immediately, which seemed to be a classical interval scheduling type problem with some casework. All of us looked at the problem and the universal consensus was that I should code this problem, as the other two were unsure of getting it right in the given time. However, it turned out that Tushar had already gotten the idea for J as well, so after ACing L he continued on to do J. With nothing better to do after Tushar ACed J, I got down to work on A.

Tushar and Shriram figured out that we were being idiots and missing a simple idea on K which finishes the problem, while I got our first WA on A. However, I quickly noted that most top teams failed a very early testcase on A, and I failed testcase 11 - meaning that I must be doing something right. Tushar started implementing K, and he got WA 3 times before he and Shriram corrected all the bugs and we got AC.

At this point, we had 5 ACs with 7 penalties and 2 hours 30 minutes had passed. We were way behind in the standings, and had lost all hope of doing well. However, we reckoned that we had nothing to lose, and these were situations we had to learn to deal with - in last year's Amritapuri regionals, we were near the top of the standings after half the contest, and proceeded to choke until the end to end up 24th. Thus, it was extremely crucial for us to be able to keep our morale and motivation high until the end of the contest to hope to win - a foreshadowing of events to come in the near future, indeed.

I got down to work on A, getting 3 more WAs in quick succession. Tushar took a look at F, which was a Prufer code problem. With Shriram, he was able to get a solution, which he wanted to code, but I told him to wait as I had some good idea on A. I corrected A, and submitted it - to get TLE on test 45! Clearly, my solution was just a bit too slow, and I needed to prune it a bit to pass in the time limit.

While I thought about how to do that in my mind, Tushar started with J, and the next few minutes were me intermittently changing something to submit, and he continuing to write J. I got 4 more WAs, with TLEs on testcase 49, and we were visibly frustated about what to do. I decided to write a heurestic-type change, which would not change the worst case for my algorithm but on average would be much faster. It was very unlikely that they would have actually found a worst case for what I had written, and voila - it passed! (with 545ms out of a 3s time limit, I may add). 10 minutes after my A, Tushar ACed J as well.

We celebrated quickly, and the standings had changed a bit. We were the top Indian team at this point, as it seemed the other teams had struggled with the harder problems, like F and A. We spent a while going through the problems left, and me and Tushar decided to go for G, while Shriram went for I. We spent 15-20 minutes getting a few observations, but getting nowhere to the complete solution. Meanwhile, Shriram said he was unable to complete I, and he was moving to D. I took a look at I, and it seemed exactly like my kind of problem. I told Tushar to look at G and Shriram to look at D, while I would solve I.

While I was thinking about I, Tushar gave up on G and joined me on I as well, as it seemed much more doable than G. I told him my thoughts - the small cases seemed to offer an insight into the problem. Greedy solutions clearly didn't work - it failed for n = 3 or 4. How do we solve this?

Suddenly, an idea struck me - how do we find the kth largest number in O(n) time? The standard quicksort algorithm works - find medians of the first 5 numbers, etc (If you are unaware of this, see the algorithm here). Thus, why not divide everything into pairs, then compare the top ones and the bottom ones in some way?

Me and Tushar started getting excited as this did seem to lead to a legit solution. Shriram said he also had progress on D which might lead to a solution. Tushar started coding the solution up while I told him the details, as I was more familiar with what the algorithm should look like, and we didn't want to make any mistakes. We coded it up to get a wrong answer on test 1, which was bemusing. We changed something, and got a wrong answer on test 1 again - why? It seemed that we made a bug with 0-indexing and 1-indexing, and submitted it again to get AC with no penalties - as fails on test 1 are not counted as penalties!

Tushar started helping Shriram on D, while I took a look at G. Shriram finished the code in 10 minutes, but had some bugs, and I was dreading that we wouldn't complete before the end of the contest. I also started looking at D and the code.

Shriram finished debugging 4 minutes before the end of the round, and submitted. We sat and looked at the progress with bated breath. Testcase 4,5,6... WA on 7. Damn.

Shriram cussed and started looking at the code quickly. He changed something and resubmitted to get WA7 again, and with that, the contest ended. It was still a very good result for us (definitely not time-wise, but number of problems solved-wise), but an AC on D would have been cherry on the cake.

We spent a few minutes looking at other problems and comments by teams who had done problems we couldn't, while Shriram found the bug in D. He submitted, and it indeed AC-ed!

Thus, this contest was a turning point for us, where we actually maintained our composure despite a very bad start to end up in a decent place at the end.

The start of the Trip

We woke at 4 am in the morning and got into the train at 6 am on the big day. We were going to take a 40-hour train journey to reach Kharagpur, which promised to be boring. However, I met an old friend in the train, and it turned out to be a fine journey after all!

The 4 of us took a manual rickshaw (i.e, someone pulled us) to the IIT campus (yes, apparently they don't have gas vehicles there - a bit of a shocker to us!). Soon enough, we reached the campus and almost immediately all three of us were sprawled on the floor, trying to get some sleep. A note about the accomodations - there were 2 beds in 1 room for 3 people, on the floor - so it was a bit uncomfortable, also with all the mosquitos around. However, it was still livable, and the food was quite decent.

Later in th evening, we spent some time formatting our notebook, and did some practice problems as well. We made friends with another team quite quickly - "Team Breadjam", from NIT Silchar. Soon, it was evening, we found a decent place to grab dinner, and we decided to get some sleep.

Next morning, it was finally time for official registrations and notebook submission. I helped our friends out with formatting their notebook, as we were already done with our final changes the day before. After registration, I decided to chill by stretching on the grass, and at some point ended up playing chess with some other team's players. Since our team didn't get any pictures last year, we decided to overcompensate this year by making sure to get pictures of everything.


From left to right: Tushar, Shriram, me

As quick as that, it was time for lunch, and then the practice round! We decided to split the practice time between us to get a good feel of the keyboard by typing out our templates.

During the practice round, we had a team right behind us who were typing out templates at breakneck speed. This really affected the concentration of my teammates, as it seemed like they were implementing suffix structures by memory, which none of us could do in a short time without prewritten code. We just hoped that it wouldn't matter much tomorrow (spoiler: it didn't). By the time the practice round ended, there were barely a few teams left.

After the practice round, we headed to a Codechef session to know about the rules for the contest - in case there was something interesting in there this year. While Anup was talking about the various initiatives of Codechef (aka mostly irrelevant to us), looking through my folder I realized that I may have forgotten our food coupons at our room. Considering that Kharagpur is the biggest IIT, it was definitely a feat to get to our room and back with our coupons in time for dinner, and none of us was willing to do it.

Me and Tushar teamed up to pressure Shriram to get the coupons, and Shriram being the good sport he is, he accepted and left to get our tickets to a full stomach. Just as he left, Anup said that there would be an interactive problem and I got somewhat excited, as I considered us to be strong in these type of problems. Tushar commented that we should go through parallel binary search once again after returning to the room, and just then, I finally found the coupons - lying in the middle of papers in my folder!

Finally checking our phones to contact Shriram, we saw that both of us had multiple missed calls from him - he had reached and found nothing there! I called him to let him know that we had the coupons, and he was extremely bemused, as anyone would be. To his credit, he was very cool about the whole thing, except that a consensus was reached that I would not be in charge of coupons for this and any future trips to occur.

Finally, we had a good dinner, and left to get some practice and sleep before the main event.




In high spirits on the morning of the contest

All of us woke very early, around 6 am on the morning of the contest - even Tushar, for which this is highly unusual (possibly could be classified as suspicious activity), woke by 7 am. We decided to take a group photo for luck before heading to meet destiny head-on.

ICPC Kharagpur Regionals 2019 

The above contest can be found here. The live commentary blog can be found here, but I recommend you see it after reading this blog.

As the contest started, we were extremely nervous. We either had to come first, or come in the top five to qualify for Asia West finals - there was absolutely no in-between. This was all or bust.

We had about 20 minutes to allow us to write down our code snippets that we would use during the contest. I quickly typed out our template, and we decided to write Disjoint Set Union, a power function with MOD operations and a segment tree implementation before the event, as these seemed to be the most likely to actually appear. We had decided on a rough strategy before - I would do maybe the first two problems, around which point Shriram/Tushar would have done some medium problems, and all problems after the first few would have one person overseeing the code, in case of doubts (called "pair programming").

1st hour

As the contest starts, I am on the computer with Tushar and Shriram going through the printouts. I quickly notice that WALKFAST seems like a Div 2A problem, with a simple if-else condition to check. I code it up quickly and go through the code once. I submit and we get the first AC of the contest! We quickly celebrate and throw the printout of the question down (This is to save time finding questions later).

I start looking at the other questions, and for a few minutes we don't solve anything else. Shriram asks me to look at MAXDIVER, and I see that people have already solved MAXDIVER and BALLCOL as well. MAXDIVER seems like a simple problem of the level of Div 2B, where we need to sort the array and change values accordingly. The main observation is that diversity increases the most when you change the value of an element from a group with the maximum number of equal values. I quickly code this up with Tushar looking on, and I submit to get AC.

Shriram is looking at AWKMINI, and Tushar looks at RANDID while I look at BALLCOL. I find a weird solution, but then me and Tushar simultaneously realize that we can do what I was thinking of in sorted order. Thus, the difficulty is a Div 2B at best, and he ends up coding it. As both he and Shriram have had a go at AWKMINI, I start working on that problem while Tushar gets AC, and both of them start working on RANDID.

I bounce a few ideas off them for AWKMINI, but then they get some idea for RANDID (which seems like a Div 2C-2D problem) and start furiously jotting down the math. I just start coding up my idea for AWKMINI (another Div 2C - 2D problem) - if this doesn't work, it will take us more than 20 minutes to come up with another solution anyway - so there's no harm in trying this out. Tushar takes over and starts coding RANDID as he has a simple formula for the answer. He gets AC on the problem, and he starts looking at ANAJOBS. Meanwhile, Shriram is looking at SEGDIR2 (cannot be classified in codeforces rating, as this is geometry - but maybe Div 2D for the idea, and 2E for the implementation).

2nd hour

I finish my code for AWKMINI, test it a bit, and submit it, expecting WA. To my pleasant surprise, we get AC and with 5 problems in our pocket without penalties in 70 minutes, we are second on the leaderboard. Tushar starts looking at RECARR (a Div 2D problem), which really seems like some easy problem which can be solved with randomization - the constraints really point towards that. I talk to Shriram and surprisingly, it seems that he solved SEGDIR2 almost immediately - it is just 2-SAT rephrased with line segment intersection.

Since I am the only one on the team who has done problems on geometry recently, I volunteer to code this up when we have nothing left to solve and some free computer time. I start copying some of our template geometry code already, when Tushar says that he thinks he has ANAJOBS. I immediately move out and start working on RECARR, which seems like the next problem we should solve. Shriram starts working on BALLSUM, where I point out we should find the answer for all colours seperately in a subset, and then sum over all subsets. We try rewriting this in a series, but we are unsuccessful.

3rd hour

Tushar gets AC on ANAJOBS, and we are 3rd, Laila having overtaken us in the meanwhile. I continue to code SEGDIR2 while Tushar and Shriram look at BALLSUM and GRAPHCON. I finish coding, ask Tushar to look over my code, and submit with a short prayer to god. It WAs, and we groan - our first WA of the contest. I find a bug almost immediately - I had copied the template incorrectly at a place, and I change it to resubmit. This also gets WA - I print out the code and start looking at it piece-by-piece. I find a few bugs, while Shriram starts coding GRAPHCON with Tushar looking on. They get WA, and they immediately print and start looking for bugs while I correct my code to resubmit. I get WA, and they have found the bug - they forgot to print the output, which was not in the samples!


Shriram ends up coding one problem in this contest, and luckily for him, that's when they choose to take our photo!
P.S. Shriram is an extremely good looking guy who always has your back, with an amazing outlook on life. He is also not in a relationship currently. He most certainly did not ask me to write this.

They add this, and indeed - we get AC! Temporarily buoyed, they begin doing BALLSUM while I am left to deal with the broken remnants of my SEGDIR2 code.

4th hour

Shriram gets an idea for VARMIN, which Tushar helps complete - it is some sort of line sweep from left to right, taking the elements which are closest. I allow him to take over once again, and I start looking at RECARR once again. The scoreboard situation is grim - FacelessMen has done 10 problems, whereas we have done 7 so far, with Laila on 8 as well - we are 3rd on the leaderboard. I calculate that if I can correct SEGDIR2 and Tushar can AC VARMIN, and Shriram can solve BALLSUM - I still need to do RECARR, since there is no chance that the other teams miss SEGDIR2, as it is a very easy problem.

Shriram also looks over the code of SEGDIR2, while I do RECARR, not understanding what is wrong with SEGDIR2. Meanwhile, Tushar ACs VARMIN in the first try! I immediately take to the computer to test some bug I found on SEGDIR2, and now I reread the entire code again. It seems absolutely perfect to me. I submit, and another WA. Now, I am seriously confused as to what is going on.

5th hour

It is the final hour, and the leaderboard has frozen. We are in 3rd place with 8 problems, whereas both FacelessMen and Laila have solved 10 problems - they have solved BALLSUM and RECARR, which we haven't. However, since we expect them to solve SEGDIR2, in effect they have done 11 problems in our minds.

Tushar starts furiously working on BALLSUM and sees that it is a convolution. I code up the FFT and he adds a few lines of code, and we get another AC. He looks at my SEGDIR2, and cannot find any mistake as well. With just a few minutes left, I change a few things and keep submitting SEGDIR2, hoping to get AC, but we end up getting around 11 WAs on this problem instead.

Aftermath

Immediately after the contest, lunch is provided. All 3 of us are in a bad mood, and I feel extremely guilty for missing what should have been the problem that should have given us a lead. But since we also missed RECARR, it seems that it didn't matter that much, and to their credit my teammates don't blame me.

Yash from FacelessMen confirms that they did do 11 problems, and it turns out that RECARR has an extremely simple randomized solution. All 3 of us hang our heads in shame for a few moments - this is one of those problems where we should have really gotten the solution. We quickly eat lunch and head back to our room for some well-deserved rest before problem discussion.

As we head back, Tushar asks me why my method of solving 2-SAT works. Basically, what had happened is - I had told him to code up 2-SAT by telling him the way you solve it, and proceeded to do something else. I think about it and realize that it doesn't - and that was the mistake! All 3 of us didn't question this obviously wrong idea, even when we had gone through the code multiple times. We shake our heads and just hope that we placed top - 3.
i.d.
Sitting in our rooms, I see that Codechef is livestreaming KGP problem discussion! I fail to understand - we hadn't been informed about this! I convince my teammates that we should go, as I've heard that sometimes they start prize distribution early, and we shouldn't miss that.

We reach the problem discussion arena almost as soon as they are wrapping up. Jatin asks if anyone has any comments, and I immediately pipe up to say that I did not enjoy the geometry problem. As the adage goes: "If you can't solve em, criticize 'em". 😛

It is abundantly clear that FacelessMen has won, no matter how hard Codechef tries to keep an atmosphere of mystery - and literally everyone in the room knows it. They do start the prize distribution ceremony, and we wait with bated breath - it turns out that we do end up 3rd, with 9 problems!


It may not have been our best performance, but it felt good.

There are a few positives from this contest - We realize that we have qualified for Asia West finals already, so in Amritapuri regionals only winning matters for us, which is great - because it is a low pressure situation (i.e., all or bust). I swear to shave before our next contest, and I claim that it is a certainty that we didn't win because I forgot to shave. Shriram strongly feels it is because we did not listen to enough K-pop, and we take a solemn oath to devote ourselves to K-pop until the end of regionals. Tushar takes it particularly seriously, with his internship in Samsung Korea coming up as well. We have some fun on the train back, messing around and discussing many problems in preparation for the next regionals.

We say bye to Shriram, as he is heading back home for a short while, while Tushar has decided to stay over at my place to practice. Shriram also plans to come to my home after a while, so that we can stay at the same place and practice without any other worries. We recognize that our dreams are now a truly possible reality - only time will tell.

Sunday, 19 April 2020

Qualifying for ICPC World Finals 2020 - An experience (Part 1 - Online Qualifications)

Hello everyone,

Today, I'll be writing on the journey to qualifying for the ICPC World Finals 2020. This blogpost has been on my mind for a while, but we have been thinking of delaying it uptil after the actual world finals. However, with the coronavirus crisis going on, I thought it'd be a good time to get my (our) thoughts on paper while they're still relatively fresh in our minds!

I'll be talking about a few things in this post (it will be long) - How we prepared, our emotions and problem solving strategy during the contest (a replay, if you will). I will mostly cover the entire India ICPC cycle from October 2019 to January 2020. First, let's get a bit of background in our team structure:

1) Shubham - A 3rd year electrical engineering student.
Strengths: Fast to solve problems, good typing speed, maths background.
Weaknesses: Doesn't code heavy datastructures much, lacks knowledge in this area. Not comfortable with HLD/Centroid or suffix structures

2) Shriram - A 3rd year electrical engineering student.
Strengths: Can think of weird solutions which turn out to be correct.
Weaknesses: Does not practice writing code much. Sometimes this leads to hard-to-find bugs.

3) Tushar - A 3rd year computer science student.
Strengths: Can code hard and lengthy data structures. Has practiced many hard problems.
Weaknesses: Does not practice writing code much. Finds it very hard to parse problem statements and many times makes mistakes due to this. Form is somewhat variable.

So now you have a rough idea of our team structure. Our team is named "BhagwanBharose", which roughly translates to "dependent on god", which was exactly our mindset going in!

The first leg of the ICPC cycle was the Preliminary online qualifications on 18th October. We all gather in Shriram's room for the contest, with some nervous energy. The qualification was a bad experience for us in 2018 - we messed up a bit and ended up 84th, which was enough to only allow us to qualify for 1 regional. We haven't practiced for over a month as a team now, which means that we dread it will happen yet again. To lighten the mood, I put on some Korean pop (which both Shriram and Tushar consider their religion) and start doing some weird dance moves, and all of us end up getting pumped up for half an hour with Twice on full blast. Literally, this IS our entire preparation, I muse silently.

Qualification Round Replay
The above contest can be found here

The online contest starts and we're in. I immediately look at the first few problems. It takes me a few minutes to realize the easiest problem, which is TRAINSET. I code it up quickly, and spend a minute re-reading the code (We learnt the hard way that morale really matters at the beginning. You want to spend a minute more and get AC instead of getting WA then AC). I think it looks correct, and it ACs.

Meanwhile, Shriram does DISCSHOP which ACs, and I tell Tushar about PENS, which seems to me a simple bitmask question. He understands and starts coding it up, while I look at SEGDIR. I get it in 10 minutes and it ACs as well. I look at BEAUTPAR and Shriram starts trying SPS, which seems to be the hardest question in the contest. Both me and Tushar encourage him to do so because the other problems seem very our-style and we should dispose of them quickly enough.

I get the idea for BEAUTPAR quickly, and I know it's something of the LIS sort - you take the prefix sums, and try to find an LIS (with starting value 0), and if this LIS length >= k, you have your desired sequence. However, it seems he is still doing PENS. I decide to get a look at SUMOR. I get a greedy idea, and I tell it to Shriram. He agrees that it looks natural, and I decide to code it and test it out. It gets AC, and we celebrate quickly.

 Tushar gets a WA on PENS and I decide to look at the code as I know the solution. It turns out he had missed a part of the solution I had in mind, and we correct that and get AC. I explain BEAUTPAR to him, and he starts coding it immediately. Meanwhile, I look at SPS, and Shriram moves to SHUFGRID.

It turns out that SHUFGRID is just a problem about maintaining some states in a markov chain type structure. Put simply, there are a few states - at the current square, in the same row, in the same column, and not in the same row or column. We just need to calculate transitions in these states.

I spend 30 minutes on SPS, not getting anywhere. Then, I start throwing everything and the kitchen sink at the problem, just trying out a lot of things and hoping that it gives the minimum. Meanwhile, 2 hours into the 3 hour contest, both Shriram and Tushar AC their problems, and we have 7 out of 8 with an hour to go. Both of them join me in SPS, where I already have a WA previously.

They find a case or two I missed, and I add some cases to cover that. I start adding more and more cases, and eventually I have some long code which works on every example we dream of. I keep submitting and getting WAs, and we don't solve it till the end of the contest. I think we have 9 WAs on this problem.

We end up 9th, which seems okay to us considering how rusty we are. We briefly celebrate with our friend Pranay, and vow to practice more from now on. Around 20 minutes later, my friends message me asking about my solution to SUMOR, saying that someone posted a counter-case on the forum which invalidates most solutions. I look at it, and my stomach sinks. It indeed fails our solution. I begin to get worried, wondering if we will only get to go to one regional again. I immediately call up other friends, and it turns out, their solutions fail too.

Soon, it turns out that there was a problem with the model solution, and thus this problem will be removed. After the ranklist released, we realize that we make both regionals anyway, thus it doesn't matter!

Anyway, this concludes part 1 of the blog. I decided to break this blog into 4 parts, wrt the 4 official contests we took part in this season, and also to increase anticipation. See you soon!

Friday, 13 July 2018

My First Semester


A small video summarizing my first semester at IIT Bombay through photos. 😄

View it here, or see it below.


Friday, 8 December 2017

My experience with NSS

So, in my first semester at IIT Bombay, I had to join one of NSO (National Sports Organization), NSS (National Service Scheme) and NCC (National Cadet Corps).

It was a tough choice, but I ended up with the NIC (National Innovation Club) department of NSS. At the end of the semester, we had to write a rough draft on our experience for the semester. Being the lazy person that I am, I tried to finish it as quickly as possible, while covering everything. So, if this seems not as well formatted as usual, I apologize. However,  I hope it makes for an enjoyable read! :)

You can read my report here (Because it's latexified and converting it back would take too long )


P.S. I've received word that some of my readers don't like the use of emojis, and from some of the readers I've heard that they do like it. So, I'll be opening a poll here - please do let me know!

The poll can be accessed on mobile devices by clicking the "View Web version" button down below.

Saturday, 2 December 2017

The ending of a new beginning!

-Some of this content was written a few days back-

Today marks the day when my final crib session at IIT Bombay for the 1st semester concludes. This day holds many mixed feelings - It's the day when I can proudly say that I've survived a semester at IIT! Not very confidence - inspiring, I know (:P).

Around this time seems to be the right time to wonder about the memorable things this semester - what I've learnt, and maybe what I should change to get a better experience out of Insti life (Yes, adopting the lingo already! :P ).

This semester is maybe (probably) the semester with the most amount of diverse courses throughout the 5 years that I'll be here. So, it was quite fun and hectic at the same time; There was a lot of learning that took place, but I was exhausted as well.

First, it's time to look back at the goals set before coming to the Insti:

Goal list 

1) Decent CPI - I would say probably check. :) While it's not going to be "stellar", it'll probably be good enough.

2) Learning and not forgetting -

Before I came to IIT Bombay, like most of the freshers, I talked to multiple seniors before this new journey of mine. There were a lot of expectations; I’ll get a great CPI while handling multiple extracurriculars, I’ll learn rather than mugging for marks, and I’ll spend a lot of times with friends at the same time, planning new outings everyday!

Needless to say, these are quite naïve thoughts – While I didn’t believe all of the above, suffice to say that everyone can daydream, right?

Something that really hit home for me was, sometimes when I asked a senior what was taught in say this – and that course, they would stutter a lot and say that the course was not really their strength and hence they don’t remember a lot. Well, I thought, I’ll do things differently. My aim for the semester was to gain a good enough understanding of the course material, that if 10 years down the line I had to present the course material, all I would take is maybe a day or two of brushing up – the concept would be deeply imbedded by then!

This sounds like quite an ambitious plan, and rightly so I believe. It’s really hard for me to even remember what was taught in school a year back – how would I go about achieving this?
The answer is that, I had to understand where everything came from! And when is this much easier to do? When you love a subject, of course! Now, here was my plan – I would choose a subject, focus on the part most interesting to me, and build everything around it. That way, there was atleast something from the course I would always remember, and I could build my peripheral stuff around it! Sounds ingenious, doesn’t it?

If you have doubts about the above approach, you’re probably correct. I’m just a student daydreaming – I have no idea what’s possible and what’s not. But, if you’re not remembering what you learn whilst doing your undergraduate degree, is it really worth the effort for a piece of paper?

Just something to think about while I expand on this topic and talk what was lacking in my approach in my next few blog posts :)

3)  Will do a lot of extracurrics along with acads - Unfortunately, this was probably not achieved. While I did some extracurrics, I didn't exactly do a lot - something that I should improve upon and prioritize accordingly for the next semester!

Sneak peak at something I created - a character called "AndaMan" (literally, Egg Man) who fights crime with his amazing omelette making skills and shoots eggs out of his palms. He also has his own theme song that states where he's from! (Hint: You can guess it quite easily :P)

4) Meet a lot of new people - Definitely a check! I met a bunch of great people at my first semester here. We've done quite some awesome stuff together and I hope to continue the same trend in the coming semesters :)

5) Going through the "DIY" approach: Actually sitting down and doing things by myself took me a lot more time than I'd expected; While it was relatively easy to be excited about doing stuff and checking out the relevant books in the library for say the first two weeks, beyond that it was hard to keep it up.

I only got around to doing this just before the endsem; I learnt the hard way that I wouldn't be scoring much without really digging into the topics. So, I spent a few days reading books, the old fashioned "classic" method~~

So, that's how my semester measured up to be in a nutshell. Next, I've planned a photo spammed post for the Electrical department trip to Lohagad Fort and a post on my thoughts and the things that I've learnt in this semester. Also, hope to add something on my plans for the vacations! I'll end with a wise quote from a friend (I'm looking at you, Kushagra!):

"Whatever you do, don't waste these vacations. Learn something useful"

I'm going to take this to heart. :)

Monday, 28 August 2017

A short note on Gliders! (& Changes to the blog!)



So, this week is pretty busy for all the freshmen students at IIT Bombay, what with the onset of the quizzing season and all! However, along with studies come extracurricular activities; and a few weeks back, I chose to attend an Aeromodelling Workshop by the Aeromodelling Club, IIT Bombay (their page is here). And I totally loved it!

Our team made a pretty basic glider, but I still learnt a lot about Aeromodelling! Here, I'd like to share what I understood from the workshop and basically how we proceeded about to make this glider successfully.

First, we learnt some Aeromodelling principles. The basic question is: How do planes work? Here, I finally felt that all those hours reading random answers on Quora was productive! The most popular theory, the equal transit theory, is infact incorrect. There is no constraint on the currents moving above and below to complete the trip in the same time.

 A few points that I've picked up from the article links I've attached at the end:

1) It's the engine which moves a plane forward, while the wings move it upward.

2) As a curved airfoil wing flies through the sky, it deflects air and alters the air pressure above and below it.

3) SxL is an important parameter for a glider, where S is the surface area of the tail and L is the length from the center of gravity of glider to the tail.

4) Using the lift equation and torque equations (for stability), we can derive certain area and length ratios which are ideal for flight. We shall use these numbers. [I've added the last 2 points on my own].

So, basically, we were given a few pointers on the number crunching part of the design.

Tail area ~ 20% of the wing area.
Fin area ~ 10% of the wing area.

For the wingspan, due to length constraints of the board we were given to construct our glider, we could choose a length anywhere between 35-45 cm. The ratio of the length to the breadth of the wing (which I believe is called the "Wing aspect ratio") should be between 5-8.

The Tail aspect ratio should be around 3-5 and the Fin aspect ratio should be 2-3. The body length should be around 6/10th to 8/10th the wingspan.

Based on these, and the above area considerations, here are the numbers we used for our glider:

Wings

b = 42 cm
c = 6.5 cm

Tail

bt = 14.78 cm ~ 14.8 cm
ct = 3.69 cm ~ 3.7 cm

Fin

bs = 8.3 cm
cs = 3.3 cm

So, our preliminary task was to cut up all the boards into the appropriate dimensions. Then, it was decided that the tail was slightly smaller than it should've been [according to our mentor eyeballing the dimensions] - so we made a slightly bigger one, although I do not remember the exact dimensions.

The main work left after this was to shape the wings to make it an aerofoil, or atleast close to one in shape. For this purpose, we used sandpaper to rub away all the extra material and make a smooth aerofoil. This was kind of crucial. After this step, we simply attached all the pieces to our fuselage and used a glue gun to stick them together!

Now, the main part left was to balance the aircraft. We used clay for the purpose. Basically, what we wanted was to use clay on the front part of the aircraft such that the center of mass lies approximately at 1/4th the breadth of the wing, on the fuselage. This is important because it makes the glider fly straight.

And after this, we were done! We made a pretty basic design, so our team was the first to finish. Although this was something really basic, I must say that I learnt a lot from this and I hope to get time to take part in such future events (especially RC Planes!).

Shubham out!

P.S. I got inspiration for that last one from watching Obama's final speech recently! Do check it out. :)

Links:

http://www.explainthatstuff.com/howplaneswork.html

https://www.faa.gov/regulations_policies/handbooks_manuals/aircraft/glider_handbook/media/gfh_ch03.pdf

Pics:


Our glider!


Team pic! Kushagra Juneja (left) and Me (right)!


P.P.S - I'd like to add that I've tried experimenting a bit with the blog. Now it's possible to subscribe to this blog via email (if anyone actually wants to! :P), via the option on the middle right. You probably can't view this on mobile devices; to do that, go to the bottom of the screen, click "View web version" and then you'll see it!

Also, I've added a Lyrics for the Week section! I'll be updating this every Sunday with some of my favourite lyrics! Hope you enjoy some of these songs after seeing them here! :)

Moving blog over

 Hi - long time no see!  Life has been busy, but I'm trying to spend more time getting back into writing this year. Toward that goal, I...