All submissions for this problem are available.
Indian police is in search of a big criminal named Jainesh. Inspector Pranjal is assigned to catch him. The city through which Jainesh is running has many tall buildings of varying heights. Pranjal is in a helicopter and he can catch the thief only in day light but the condition is, he should not be in the shadow of any of the buildings.
The total number and height of the buildings are given. Also, their respective distances to the right of origin is given. The thief is running towards origin and his initial position is the end point of the last building's shadow (last building refers to the building that is to the rightmost of origin) at the given starting time. The speed 'sp' of the thief is provided in terms of units/15 mins.
At 06:00, the sun rises from -inf to the left of origin and the motion is in semi-circular manner towards +inf. At 1200 hours, the sun is exactly over head. Then it sets at 18:00 to the right of origin at an infinite distance.
The motion of the sun as well as that of the thief is discrete and they move after every 15 mins. That means the position of the shadows and the thief will change after every 15 mins.
Help Inspector Pranjal catch Jainesh.
- The sun rises at 06:00 and sets at 18:00. The sun rays are parallel. It is at infinite distance from earth
- If the thief is exactly under the building, then he is in the shadow.
- Buildings are to the right side of origin on X-axis.
- For any floating point value, take ceiling of the value.
- If the thief reaches the origin or to the left of it, then he is not caught.
- No two buildings will be at the same position. Consider building as single vertical line.
e.g; 2.7 should be considered as 3.
The first line contains the number of test cases 't'. For each test case, the next 3 lines are in the following manner:
First line contains three space separated integers: 'n'(number of buildings), 'st' (The starting time in HH format) and sp (The speed of thief in units/15mins)
Second line will contain 'n' space separated integers denoting the heights of the buidings (HT).
Third line will contain 'n' space separated integers denoting the distance of the building from the origin to its right (D).
If the thief is caught, print the time when he got caught in the format HH:MM(Consider
24 hrs clock); else print “Commissioner nahi chodega”(without quotes) on a new line.
1 <= t <= 10
1 <= n <= 50
06 < st < 18
1 <= sp <= 5
1 <= HT[i] <=100
1 <= D[i] <= 1000
Sample test case:
3 10 1
5 4 3
4 7 9
At 11:15, Jainesh is in daylight and not in shadow of any building, so Inspector Pranjal caught him. Initial position for this test case is shown in the figure that can be found here
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.