Easy Coding Contest 6 - Editorial

All contest related discussion goes here. Both Dev Skill and Non Dev Skill contest related discussion is allowed. (But please keep the forum clean)

Easy Coding Contest 6 - Editorial

by devskill » Tue Nov 15, 2016 6:13 pm

IMPORTANT! Read before you post in this thread if you do not want to get banned.

Q: What is "Editorial Thread"?
A: Until we have some custom forum or system, we will use this forum for posting editorial for contest problems. After each contest we will create a sticky thread in the "Contest Discussion" forum for that particular contest. Please read the following rules very carefully to keep things under control.

  • Dev Skill will create the editorial thread, none else should create this.
  • Anyone including problem setters can post reply to this thread to post editorials. But only those who has solved the problem and has a unique solution should post. Thus the option to posting editorial is NOT limited to only problem setters, rather open to everyone.
  • Anything other than editorial should NOT be posted here. No question, No thanks, nothing else. We must keep the thread clean. If anyone oppose the solution posted, then he/she may post a reply to defend his/her view, but it may not go deeper in this thread. Rather you can create a new thread and link that thread in your opposing reply so that the discussion can continue there.
  • Anyone violating the rules, their posts will be deleted and they will be warned. If they continue to do this, a temporary ban will be applied. If that continues, we will take harder action against you. But we hope that do not happen.
  • Posting editorial is a volunteer work and it is not an official editorial of Dev Skill. People may or may not post their solution, you should not scream or shout or apply force to post editorial.
  • Very Important! As we allow score for solving offline problem, we do not want that you give away the solution. Posting code, pseudo code, or complete give away solution is strictly prohibited. You should give hint only - like what algorithm can be used, what techniques can be applied etc. If you are not sure, read previous editorials to get an idea.
  • These rules may get updated frequently, so make sure you check the rules for every editorial threads. Most of the time we will copy it, but sometimes changes can be there.
User avatar
Site Admin
Posts: 118
Joined: Tue Feb 02, 2016 10:24 pm

Re: Easy Coding Contest 6 - Editorial

by jalal » Tue Nov 15, 2016 7:00 pm

Break Simulator

This is a very easy problem. Most probably this was the easiest problem in the contest and got most solve.

This problem is based on a basic physics equation from high school physics. Formula for deceleration can be easily found in internet or in physics book. The only tricky part is the final velocity of the car will be zero as the problem statement says, the car will completely halt. If you know the formula and if you are able to process input/output, then there is nothing else that will stop you from solving it.
User avatar
Posts: 1
Joined: Tue Nov 15, 2016 6:18 pm

Re: Easy Coding Contest 6 - Editorial

by showmic » Wed Nov 16, 2016 10:08 am

Easy Sequence

In this problem if you observe all the term you will get a relation between them. There is actually 4 term given in the problem 3 is in the main question and one is in the sample input/output. So it is actually pretty much easy to find the sequence after observing those four term.
Posts: 3
Joined: Wed Nov 16, 2016 9:59 am

Re: Easy Coding Contest 6 - Editorial

by froghramar » Wed Nov 16, 2016 3:20 pm

Make It Palindrome

If you have already solved some problems based on dynamic programming, you should not find it hard to solve this problem.

Can you write a recursive function to check if a sub-string of a string is palindrome or not? I hope you can. My solution is very similar to a recursive palindrome checker. What do you do in a palindrome checker? If you find a match in both sides of your sub-string S[l, r] you can reduce your problem to S[l + 1, r - 1]. Otherwise, you can say that the sub-string is not palindrome.

Now, you are not asked to answer if the given string is palindrome or not.

Let's define dp[l][r] as the minimum number of characters to add to make the sub-string S[l, r] a palindrome. Now you can solve your problem with two simple transactions.

1. If S[l] and S[r] are equal, you can not get a better solution than considering S[l] and S[r] as reflexive characters of your new palindromic string, as you are not having any cost of adding a new character.

Example, Result("ahbfhba") = Result("hbfhb");

So, dp[l][r] = dp[l + 1][r - 1], if S[l] = S[r].

2. If S[l] and S[r] are not equal, then you have no other option than adding an extra character in one of the sides to have a match. Let say, your current string is dfghdc. If you want to have a match in both sides, you can make it dfghdcd or cdfghdc.

Result("dfghdc") = 1 + Minimum ( Result("fghdc"), Result("dfghd") ).

So, dp[l][r] = 1 + Minimum (dp[l + 1][r], dp[l][r - 1]), if S[l] != S[r].
User avatar
Posts: 33
Joined: Thu Jul 28, 2016 8:14 am
Location: Amar Ekushey Hall, University of Dhaka

Re: Easy Coding Contest 6 - Editorial

by showmic » Thu Nov 17, 2016 11:41 am

My Merit Position

In this problem there will be given N the number of student. In the next N line there will be two input one string and one floating point number.

Now for storing those number we can use structure consist of string and double. Like :

struct myStruct{

string name;
double cgpa;

Now we have to sort those data according to the question. But be careful about the merit position in the time of printing the output as two or more person can have same merit position.
Posts: 3
Joined: Wed Nov 16, 2016 9:59 am

Easy Coding Contest 6 Editorial

by lAnohizE » Fri Jun 16, 2017 2:46 am

Ive used that idea too, but I think people get lost in it when theres no visual.

Pressure = brightness seems harder to get than depth = brightness...as they can visualize depth and not pressure.

I wanted to explain lumens vs lux more than how to get throw vs flood per se...with an easy way to visualize what each is about.
Posts: 2
Joined: Thu Jun 15, 2017 12:35 am
Location: Broornnerne

Бижутерия своими руками

by lAnohizE » Tue Oct 22, 2019 9:43 pm

Posts: 2
Joined: Thu Jun 15, 2017 12:35 am
Location: Broornnerne

Who is online
Users browsing this forum: No registered users and 1 guest