#include using namespace std; long odd_max(int k,int N,vector& a,vector& a_sum){ int index = k/2; int left = k/2 + 1; int right = N - k/2; int mid = a[index]; long ans = a_sum[N] - a_sum[right] + a_sum[left] - (long)k * (long)mid; return ans; } long even_max(int k,int N,vector& a,vector& a_sum){ int index1 = k/2 - 1; int index2 = k/2; int left = k/2 + 1; int right = N + 1 - k/2; int mid2 = a[index1] + a[index2]; long ans = a_sum[N] - a_sum[right] + a_sum[left] - (long)k * (long)mid2 / 2; return ans; } int main(){ int N; cin >> N; vector a(N,0); vector a_sum(N+1,0); for(int i=0;i> a[i]; } sort(a.begin(),a.end()); for(int i=0;i