Skip to main content


#Round 62
Div 2A
problem link:

A. Way Too Long Words time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome. Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation. This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes. Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n". You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by…
Recent posts
So guys let's get started with our training its been many years even i haven't practiced competitive programming but no worries we'll gonna excel it together.Our approach for the training will be to pick a problem and then solve it with nice explanation so that it can be understood nicely.The link for the sorted list of problems in codeforces is here.
I'll practice from the very first problem  Div 2-4A (Watermelon)

One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem. Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tir…

Forget Efficiency and start solving easier problems

Sometimes, you may notice that many programmers solved many problems but they made very few submissions (they are geniuses!). At first, you may think that I should try to solve the problems as less try as possible. So, after solving a problem, you will not want to try it again with other algorithm (may be far far better than the previous algorithm you used to solve that problem) to update your rank in the rank lists. But my opinion is that if you think so you are in a wrong track. You should try other ways as in that and only that way you can know that which of the algorithms is better. Again in that way you will be able to know about various errors than can occur. If you don’t submit, you can’t know it. Perhaps a problem that you solved may be solved with less time in other way. So, my opinion is to try all the ways you know. In a word, if you are a beginner forget about efficiency. Find the easier problems.Those problems are called ADHOC problems. You can find the list of those pro…

New practice session for all the programmers with me.

So guys sorry i had been missing around for a while due to academic pressure and now i promise that i will keep on updating the blog with exciting and interesting blog posts so all those who are interested to learn competitive programming from scratch can start with me.I will start posting the resources to learn the concept and some problems based on those topics.Good luck.

I will  start the training from 5th june.

sorting algorithms explained part 2

Selection Sort Algorithm Selection sort algorithm starts by compairing first two elements of an array and swapping if necessary, i.e., if you want to sort the elements of array in ascending order and if the first element is greater than second then, you need to swap the elements but, if the first element is smaller than second, leave the elements as it is. Then, again first element and third element are compared and swapped if necessary. This process goes on until first and last element of an array is compared. This completes the first step of selection sort. If there are n elements to be sorted then, the process mentioned above should be repeated n-1 times to get required result. But, for better performance, in second step, comparison starts from second element because after first step, the required number is automatically placed at the first (i.e, In case of sorting in ascending order, smallest element will be at first and in case of sorting in descending order, largest element wil…

Sorting algorithm explained part 1.

Introduction to Sorting Sorting is nothing but storage of data in sorted order, it can be in ascending or descending order. The term Sorting comes into picture with the term Searching. There are so many things in our real life that we need to search, like a particular record in database, roll numbers in merit list, a particular telephone number, any particular page in a book etc. Sorting  arranges data in a sequence which makes searching easier. Every record which is going to be sorted will contain one key. Based on the key the record will be sorted. For example, suppose we have a record of students, every such record will have the following data: Roll No.NameAgeClassHere Student roll no. can be taken as key for sorting the records in ascending or descending order. Now suppose we have to search a Student with roll no. 15, we don't need to search the complete record we will simply search between the Students with roll no. 10 to 20. Sorting Efficiency: There are many techniques for so…

How many questions, on an average basis, shall I solve daily, to become a top-level competitive programmer?

As many as you’ll manage to solve while practicing intensively instead of running for numbers.

This question in fact make not too much sense. You don’t even give definition of “top-level competitive programmer”. I know people who say a coder with yellow rating is basically a stupid newbie. I know people saying that making into CF div1 means being a top-level contestant, an inspiration for everyone around. Which one fits better for your scale?

You didn’t put any timetable - do you want to reach that level in a year, or two, or ten years?..

Number of problems that you solve isn’t the exact indicator of how productive you are, or how intense is your preparation, or how much new stuff you learned. There is some probability that you’ll use fixed number to motivate yourself: “I haven’t solved enough problems today, I should keep practicing instead of going to do something else”. But, on the other hand, there is decent probability that you’ll intentionally or unintentionally switch to easie…