We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Data Structures
  3. Advanced
  4. Two Array Problem

Two Array Problem

Problem
Submissions
Leaderboard
Discussions
Editorial

In this problem you operate on two arrays of integers. We will call them the and the respectively.
Your goal is just to maintain them under the modification operations, such as:

  • 1 : Reverse the subarray of the array, starting at the number, ending at the number, inclusively;
  • 2 : Swap two consecutive fragments of the array, the first is from the number to the , the second is from the number to the ;
  • 3 : Swap the piece that starts at the number and end at the one between the and the array;
  • 4 : We consider only the piece from the number to the one. The numbers in the array are -coordinates of some set of points and the numbers in the array are -coordinates of them. For the obtained set of points we would like to place such a circle on a plane that would contain all the points in it and would have the minimal radius. Find this minimal radius.

Input Format
The first line of input contains two space separated integers and denoting the number of integers in arrays and the number of queries respectively.
The second line contains space separated integers: the initial elements of the array.
The third line contains space separated integers: the initial elements of the array.
Then there are lines containing queries in the format listed above.

Output Format
For each type-4 query output the sought minimal radius with exactly two symbols after the decimal point precision.

Constraints

All the numbers in arrays are non-negative and don't exceed .
The sum of over the type-4 queries won't exceed .
In the query of the type 2, .
In the queries of the types 1, 3, 4, ; .

Sample Input

10 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
3 2 6
1 0 9 9
4 6 9
2 0 2 7 9 9
1 0 3 6
2 1 2 3 4 5
1 1 7 10
2 1 8 8 9 10
4 6 9
2 0 2 2 4 6

Example Output

2.12
2.50

Author

zxqfd555

Difficulty

Hard

Max Score

150

Submitted By

1214

Need Help?


View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy