Here gcd(x,y) means the best normal divisor (GCD) of integers x and y, and lcm(x,y) indicates the most un-normal numerous (LCM) of integers x and y.    You are given an exhibit an of length n. Each second the accompanying occurs: every component computer based intelligence of the exhibit is supplanted by the

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

 

 

Here gcd(x,y) means the best normal divisor (GCD) of integers x and y, and lcm(x,y) indicates the most un-normal numerous (LCM) of integers x and y. 

 

You are given an exhibit an of length n. Each second the accompanying occurs: every component computer based intelligence of the exhibit is supplanted by the result of all components of the cluster (counting itself), that are neighboring the current worth. 

 

Let di be the number of neighboring components to artificial intelligence (counting computer based intelligence itself). The magnificence of the exhibit is characterized as max1≤i≤ndi. 

 

You are given q questions: each inquiry is portrayed by an integer w, and you need to output the excellence of the exhibit after w seconds. 

 

Input 

 

The originally input line contains a solitary integer t (1≤t≤105) — the number of experiments. 

 

The main line of each experiment contains a solitary integer n (1≤n≤3⋅105) — the length of the cluster. 

 

The accompanying line contains n integers a1,… ,an (1≤ai≤106) — cluster components. 

 

The following line contain a solitary integer q (1≤q≤3⋅105) — the number of inquiries. 

 

The accompanying q lines contain a solitary integer w each (0≤w≤1018) — the actual questions. 

 

It is ensured that the amount of qualities n over all experiments doesn't surpass 3⋅105, and the amount of qualities q over all experiments doesn't surpass 3⋅105 

 

Output 

 

For each inquiry output a solitary integer — the magnificence of the exhibit at the comparing second.

 

 

 

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education