# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
793383 | kingfran1907 | Fireworks (APIO16_fireworks) | C++14 | 0 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long llint;
const int maxn = 2e5+10;
int n, m;
int parr[maxn], len[maxn];
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++)
scanf("%d", len+i);
sort(len, len+m);
int ac = (m / 2);
llint sol = 0;
for (int i = 0; i < m; i++) sol += abs(len[ac] - len[i]);
printf("%lld\n", sol);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |