0% found this document useful (0 votes)
75 views6 pages

Biq-004-Flukelandcrawler: Time Limit: 10 Secs

Fluke needs to rescue survivors of a spaceship crash on a distant planet. You are KHAL, an AI assistant created to help Fluke navigate the unintuitive controls of the rescue rover to find an optimal path that saves survivors with the highest total rank. Input provides survivor locations and ranks across test cases on a square grid, and the output should be the maximum total rank that can be saved and the corresponding rover command sequence(s).

Uploaded by

Poonam RS
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views6 pages

Biq-004-Flukelandcrawler: Time Limit: 10 Secs

Fluke needs to rescue survivors of a spaceship crash on a distant planet. You are KHAL, an AI assistant created to help Fluke navigate the unintuitive controls of the rescue rover to find an optimal path that saves survivors with the highest total rank. Input provides survivor locations and ranks across test cases on a square grid, and the output should be the maximum total rank that can be saved and the corresponding rover command sequence(s).

Uploaded by

Poonam RS
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

BIQ-004-FlukeLandCrawler

Time limit : 10 secs. (The program must produce output for all test cases within the
stipulated time)

A spaceship carrying a convention of high ranking officials had a close shave with a
meteor. They are now scattered over the surface over a meteor and the spaceship
is beyond repair.

Fluke LandCrawler was an emergency replacement for a space rescue mission in


the distant galaxy Alfa-Bentauri. You are KHAL – the computer on the land-Rover
carrying Fluke. He needs to rescue as many survivors as possible but can’t figure
out the best path. Fluke lied about his CompSc. Degree to get in to SpaceTravel Inc;
he is banking on you to save his job.

Just to make things worse, Fluke’s shuttle was designed by Elbonians and not tested
before being deployed due to this unforeseen emergency. You now find that the
“Back”, “Left”, “Right” and “Fwd” buttons on the shuttle are unintuitive to say the
least:

e.g. if Fluke’s Rover is in the slot marked as FL below (facing east), there are 4
possible slots that he can move to (shown in Blue). In short, it can not move back
(towards the west) and is always facing east. He can only rescue people by moving
to the slot that they are standing in.

Each survivor of the crash has a rank R (1<= R <= 5) e.g. some are Chancellors
Rank5 and at the other end of the spectrum are Guards Rank1.

Determine the optimal path – that can

- save a group of people with the maximum total rank. High ranking officials
are key to maintaining peace across various factions in the federation.
Guards are sworn to protect them and will stay behind if required.
- If you have one optimal path, you should tell Fluke the command seq for
the same. If more than one path is optimal, you should tell Fluke all the
possible command seq and let him decide

- Time is of the essence – it is critical that the people be rescued as quickly as


possible.

Input
- The first line contains n where n is the side of the square grid on which the
rover will move. 4 <= n <= 100. Top-left co-ordinate is (0,0) and bottom
right co-ordinate is (n-1, n-1)

- The next line is the number of test cases n (2 in the example below) that
follow (< 5). Each test case is comprised of a number of lines.

o The first line of the test case contains the position where the space
rover is beamed down/placed initially (facing east).

o The next line contains the number of survivors, k.

 This is followed by k lines, each having 3 integers relevant to


each survivor. E.g. 1 3 5 indicates that there is a survivor at
(1,3) and has Rank 5.

4
2
0 1
4
1 3 5
2 0 5
2 2 1
3 2 3
0 1
5
1 3 5
2 0 5
2 2 5
3 0 5
3 2 3

The test cases represent the following scenarios respectively.


Output
You should print out the results to console (via printf or equivalent)

For each test case, output the maximum cumulative rank of people you can save as
the first line. That is to be followed by the command seq (1 or multiple) for the
path(s) – See the example below.

8
LB
BL
10
RF

Explanation:

Rules:
• Please solve it on your own/submit your own solution. You may be asked to
build an extension to this program or an advanced variant of this type of
problem in person in the future.
• You may implement the program in either C/C++/C#/VB.Net/Java. If you
choose to use C or C++ please mention the compiler version that you’re
using in the email.
• Submit your source code as a single file as an email attachment (Do not
compress it to zip/archive format). We would compile your program into an
executable and run it (e.g. c:\>X.exe TestCases.txt)
• Your program must accept a string as a command line argument. It should
then proceed to open the file of that name in the same/current directory,
which contains one or more test cases. Output should be printed to console
via printf (or equivalent).
• The program will not expect any user input. Please test your program for
compile / run time errors before submitting.
• You may submit multiple submissions – strive for solutions that are elegant,
memory and time efficient.
• The time limit if specified is for all the test cases to be executed; the time
limit is NOT per test case
BIQ-005-Accelerator

You’ve been given an assorted set of gears. Each gear has a different number of
teeth – the notches on a gear that interlock with notches on another gear to
transmit speed. You have a couple of belts one coupled to an input and the other for
the output. You are given the rpm of the input belt Si and a minimum value So
(where So > Si) so that you can increase the speed via a system of gears as
shown above

You need to figure out all the possible pairs of gears that can be used to achieve an
output rpm >= So.

Input
The input is specified in a file containing test-cases.

• The first line contains the number of gears that are available to you, g.

• The next line contains g numbers indicating the number of teeth on each
gear, separated by spaces.

• The next line contains the number of test cases – n

o This is followed by n test cases. Each test case is specified by 2 speed


values on a single line. (So here the first test case specifies that you
need to design a gear-system that increases Si = 50 rpm to a value
above 200 rpm)

7
20 10 4 6 40 25 100
2
50 200
35 75

Output
9
15
E.g. for raising the speed from 50 to 200, any of the following 9 pairs can be used

[100, 6] [40, 6] [25, 6] [25, 4] [20, 4] [40, 4] [100, 4] [100, 20] [100, 10]

Rules:
• Please solve it on your own/submit your own solution. You may be asked to
build an extension to this program or an advanced variant of this type of
problem in person in the future.
• You may implement the program in either C/C++/C#/VB.Net/Java. If you
choose to use C or C++ please mention the compiler version that you’re
using in the email.
• Submit your source code as a single file as an email attachment (Do not
compress it to zip/archive format). We would compile your program into an
executable and run it (e.g. c:\>X.exe TestCases.txt)
• Your program must accept a string as a command line argument. It should
then proceed to open the file of that name in the same/current directory,
which contains one or more test cases. Output should be printed to console
via printf (or equivalent).
• The program will not expect any user input. Please test your program for
compile / run time errors before submitting.
• You may submit multiple submissions – strive for solutions that are elegant,
memory and time efficient.
• The time limit if specified is for all the test cases to be executed; the time
limit is NOT per test case

You might also like