Submit | All submissions | Best solutions | Back to list |
FFARM - Fruit Farm |
We visited a farm, which was barren except for certain points in which fruit trees existed. In general it was true that only places with palindromic indices contained fruit trees. We are required to buy a subregion of this farm of length at most L so that our aims (in the given priority) are satisfied best.
1. Maximize the amount of fruit trees present in it.
2. Minimize the size (length) of the farm bought.
3. Select the farm whose beginning is leftmost.
Input
The 1st line contains the number of test cases, T<=20, each test case:
A B L
where [A,B] is the closed interval of land which we visited.
Output
S E
where [S,E] is the closed interval of land which we buy.
If there is no fruit-tree in the visited interval, print "Barren Land."
Constraints:
1<=A<=B<=1000
Example
Input:
6
1 10 5
800 1000 5
80 120 5
30 60 12
12 18 40
23 30 10
Output:
1 5
808 808
99 101
33 44
Barren Land.
Barren Land.
Added by: | Prasanna |
Date: | 2006-01-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 VB.NET |
Resource: | ByteCode '06 |
hide comments
2023-09-19 17:32:34
Yeah accepted |
|
2016-01-08 06:48:05 Sanjeev Kumar
same problem here....not sure what test cases are failing:| |
|
2015-08-12 20:12:22
Hi, I'm getting wrong answer for my solution and I tested for every kind of input, answer is coming correct. I'm not sure for which cases, its failing. is there any way I could get the test cases set? |