Editorial - C For Code 05 - 5th Contest of ISM Dhanbad Coding Championship
Cartman Stole Cookies
It appeared as the easiest problem of the Codeforces Round
#152 (Div. 2). I solved it after 7 minutes 9 seconds without any penalty in the
real contest.
The Solution was quite simple, take four variables:
L1 = No. of open Left cupboard doors
L0 = No. of closed Left cupboard doors
R1 = No. of open Right cupboards doors
L0 = No. of closed Right cupboards doors
Then the answer is min(L1,L0)+min(R1,R0)
Butters and Magical Numbers
It appeared as the second easiest problem of the Codeforces
Round #150 (Div. 2). I solved it after 33 minutes and 26 seconds in the real
contest without any penalty.
My solution was quite different from what other participants
had done.
Obviously checking 10^9 numbers would give Time Limit
Exceeded. So to avoid this on the online judge, I made a program that
calculates the answer for all the 10^9 numbers and prints the answer in a file
for every number that is divisible by 1000000. I ran the program locally and it
took around 100 seconds for it to run. I used these values from the file to
initialize an array with 1000 elements and whenever we had a query, I only had
to check at max 1000000 values. For ex.
For 98547574, I know the answer for 98000000, So I just need
to check the remaining 547574 numbers.
Kyle Types Text
It appeared as the third easiest problem of the Codeforces
Round#154 (Div. 2) and as the easiest problem of the Round#154 (Div. 1). I
participated in Div. 2 and solved it after 1 hour 30 minutes and 41 seconds
with one penalty.
In this problem we have to try every possible combination to
reach from Line X1 to Line X2 without repeating any path. For ex. Let the no.
of lines be 5 and X1=2 and X2=4. Then we may go from X1 to X2 following the
below mentioned Line no. combinations:
2 -> 1 -> 2 -> 3 -> 4
2 -> 1 -> 2 -> 3 -> 4 -> 5 -> 4
2 -> 3 -> 4
2 -> 3 -> 4 -> 5 -> 4
In all these combinations we can determine the Y position of
the cursor when it reaches the 4th line as the minimum of the
initial Y position and the end positions of all the lines that have been
visited. After it comes to the 4th line, move the Y position to the
desired position. Minimum of all these will give the answer.