Problem A.
#include <lastweapon/io>
using namespace lastweapon;
const int N = int(2e5) + 9;
LL a[N]; int n;
LL z;
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
Rush {
RD(n); REP(i, n) RD(a[i]); sort(a, a+n);
LL z = a[n-1]*a[n-2] + a[1]*a[0];
DWN(i, n-2, 0) z += a[i] * a[i+2];
cout << z << endl;
}
}




Alca
Amber
Belleve Invis
Chensiting123
Edward_mj
Fotile96
Hlworld
Kuangbin
Liyaos
Lwins
LYPenny
Mato 完整版
Mikeni2006
Mzry
Nagatsuki
Neko13
Oneplus
Rukata
Seter
Sevenkplus
Sevenzero
Shirleycrow
Vfleaking
wangzhpp
Watashi
WJMZBMR
Wywcgs
XadillaX
Yangzhe
三途川玉子
About.me
Vijos
