Four Arrays Codechef Solution | May CHALLENGE


Four Arrays Codechef Solution

You have been given an integer KK and four arrays AA, BB, CC, and DD with sizes SASA, SBSB, SCSC and SDSD respectively.

Follow the given steps:

  • Pick four indices xx, yy, zz, and ww from arrays AA, BB, CC, and DD respectively. Note that (1≤x≤SA)(1≤x≤SA), (1≤y≤SB)(1≤y≤SB), (1≤z≤SC)(1≤z≤SC) and (1≤w≤SD)(1≤w≤SD).
  • There are in total SA×SB×SC×SDSA×SB×SC×SD ways to do the above step. For each way, write down the value of (Ax+By)×(Cz+Dw)(Ax+By)×(Cz+Dw) on a board.
  • Sort all the numbers written on the board in non-decreasing order.

Find the KthKth element written on the board.

Input Format

  • First line contains five integers SASA, SBSB, SCSC, SDSD and KK.
  • The second line contains SASA space-separated integers A1,A2,…,ASAA1,A2,…,ASA denoting the array AA.
  • The third line contains SBSB space-separated integers B1,B2,…,BSBB1,B2,…,BSB denoting the array BB.
  • The fourth line contains SCSC space-separated integers C1,C2,…,CSCC1,C2,…,CSC denoting the array CC.
  • The fifth line contains SDSD space-separated integers D1,D2,…,DSDD1,D2,…,DSD denoting the array DD.

Output Format

For each test case, output the required number in a single line .


  • 1≤SA,SB,SC,SD≤3⋅1041≤SA,SB,SC,SD≤3⋅104
  • 0≤Ai,Bi,Ci,Di≤1050≤Ai,Bi,Ci,Di≤105

Sample Input 1 

2 1 3 2 10
2 3
1 1 2
3 1

Sample Output 1 



After sorting the numbers on the board are in the following order {8,8,10,10,12,15,16,16,20,20,20,25}{8,8,10,10,12,15,16,16,20,20,20,25}. So, the 10th10th number is 2020.

Four Arrays Codechef  SOLUTION

Download Code
login to google play console, youtube video search by image, how to add a google account, which are the google apps, what is the google app, how to add a new google account, all the google apps, which service is the part of google, adsetting google, google data studio, google DNS, GCP console, bigquery, google studio, google api console, google app engine, anthos, google apis, google public DNS, google audio, google launcher, gcloud console, google compute engine, google webmaster console, google logged-in devices, gdrive unlimited,google console tools,google studio login,my google voice,hey google service,find similar images google, my google forms, www google com bd search, search using images in google,google image search scan,google sea console,website console google, google sound, gdrive storage for students, google site console, google console login, webmaster console, searc h console, google server down, google backup login, photo finder google, google products and services, google console tool, google image check, google cloud search is used for, google dashboard studio, google voice and audio activity,gcp dashboards, google services down, google go app, google dns down, google image identifier,check picture on google,google new launcher,google image finder online,image check google google google go, image finder on google, finding images on google, photo find google, find a picture in google, find the photo on google, picture find google, image find on google, find with photo google, image finder google online, google find with image, photo finder in google, google find image search, search using image in google, search on google with image, google server down today, google server down news

Read More Post Here

Leave a Comment

Your email address will not be published. Required fields are marked *