PROBLEM LINK :
Author : Vibhor Gupta
Tester : Vibhor Gupta
Editorialist : Vibhor Gupta
Arrays, Euclid’s Distance
Rahul has been given a new task.
He has been given N points on the x-axis, X1,X2,…,XN.
Now he is being asked Q queries. Each query gives him his position on the x-axis X, and asks him the sum of distances from his position and the N points.
As the sum can be quite large, he has been told to print the answer modulo 7630367.
He has written a program to calculate every query, but it seems to be giving him vague answers.
Flawed Code :
#define ll long long
using namespace std;
This question used a small trick to calculate the distances for each point from either sides.
The corrected code can be view at, Corrected Solution