Set 105Question 66

Rakib's Maximum Spread Team

Very hardWritten in CMust finish in 5 seconds

Rakib is forming a diverse review panel at a bank branch of a fixed size, maximizing the spread of expertise scores across all pairs.

What your program reads

Line1: N. Line2: N integers. Line3: Q. Next Q lines: X.

What your program prints

Max pairwise-spread sum per query X.

Limits

1 ≤ N,Q ≤ 10^5

Example input

5
1 2 3 4 5
1
2

Expected output

4
main.c

Your work is saved in this browser as you type.

Loading editor…
Input for Run

Run tries your code on the input above and shows what it prints. Submit checks your output against every test, including hidden ones.

Shortcut: Ctrl + Enter sends it to the judge.

Rakib's Maximum Spread Team · DIU ContestHub