Time Lapse :13min 5sec 4050.c123456789101112131415161718192021222324252627282930313233343536373839404142434445//#pragma GCC optimize ("O3")#define gc() getchar_unlocked()#define pc(x) putchar_unlocked(x)#include <stdio.h>#include <memory.h>#include <stdlib.h>int clothes[100000], N;long answer = 0;int readINT() { int N = gc(), ret = 0; do { ret = (ret << 3) + (ret << 1) + (N & 0b1111); N = gc(); } while (48 <= N); return ret;} void writeANSWER(int tc) { long rev = 0, count = 0; pc(0x23); while (!(tc % 10)) { count++; tc /= 10; } while (tc) { rev = (rev << 3) + (rev << 1) + tc % 10; tc /= 10; } while (rev) { pc(rev % 10 | 0b110000); rev /= 10; } while (count--) pc(0x30); count = 0; pc(0x20); while (!(answer % 10)) { count++; answer /= 10; } while (answer) { rev = (rev << 3) + (rev << 1) + answer % 10; answer /= 10; } while (rev) { pc(rev % 10 | 0b110000); rev /= 10; } while (count--) pc(0x30); pc(0x0A); return;}int compare(const void *a, const void *b) { return *(int*)a > *(int*)b ? 1 : -1;}int main(int argc, char** argv) { register int tc = 1, T = readINT(); for (; tc <= T;) { N = readINT(); for (int i = 0; i < N; i++) clothes[i] = readINT(); qsort(clothes, N, sizeof(int), compare); for (int i = N - 1; i >= 0; i--) if ((N - i) % 3) answer += clothes[i]; writeANSWER(tc++); }}