​http://acm.hdu.edu.cn/showproblem.php?pid=2673​

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
int n,a[10050];
while(scanf("%d",&n)!=EOF)
{
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
int j=0,i=n-1,k=1;
printf("%d",a[i--]);
for(;k<n;k++)
{
if(k%2!=0)
printf(" %d",a[j++]);
else
printf(" %d",a[i--]);
}
putchar('\n');
}
return 0;
}