modifY the first line of Team title
#pragma GCC optimize (3) // optimizing metaphysical #include <cstdio> #include <algorithm> the using namespace STD; int main () { int n-, K; Scanf ( "% D% D", & n-, & K); int C [K +. 5], D [K +. 5]; Long Long int ANS = 0; for (int I = 0; I <K; I ++) Scanf ( "% D", & C [I]); // input value sort (c, c + k) ; // Sort int l = 0, r = n ; // left position for (int = K-I. 1; I> = 0; I -) { D [L] = d [r] = c [i ]; // current maximum value in the array ends ans = ans + c [i] * (rl-1); // modify answers ++ l; - r; / move inwardly / left position if (l> = r) break ; // two positions coincide } the printf ( "% LLD", ANS); // output return 0; // end }
Here I wish myself noip2019rp ++! ! !