Problem List
855 - Lunch in Grid City

Difficulty : easy

 

Solution Description :


Sorting & Find Median Problem

Median (found by using sort). Sort both lists of streets and avenues independently and print the median value of both. Choose the smaller of 2 median values.

1. First sort the streets.
2. Sort the avenues.
3. Suppose they are in arrays,
   s[] is the street number, a[] is the avenue number
   starting from 1 to F (F is the total friend)
4. If F is odd assign j <- (F+1)/2
5. Otherwise assign j <- F/2
6. Print s[j] and a[j]......

 

 

Test your input

Your input here...

 

Generated output