#include
#include
#include <bits/stdc++.h>
using namespace std;int main()
{
int T;
cin >> T;
cin >> ws;
for(int j = 0; j<T;j++)
{
unsigned int n;
cin >> n;
cin >> ws;
unsigned int a[n];
for(int i = 0; i<n; i++)
{
unsigned int f;
cin >> f;
cin >> ws;
a[i] = f;
}
sort(a,a + n);
cout << 2*(a[n-1]-a[0]) << endl;
}
}
This was giving correct answers with the example input but wasn’t accepted. What am i missing here?