# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154214 | KCSC | Akcija (COCI15_akcija) | C++14 | 2 ms | 380 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;
const int DIM = 100005;
int arr[DIM];
int main(void) {
freopen("b.in", "r", stdin);
freopen("b.out", "w", stdout);
int n;
cin >> n;
long long ans = 0;
for (int i = 1; i <= n; ++i) {
cin >> arr[i];
ans += arr[i];
}
sort(arr + 1, arr + n + 1);
for (int i = n - 2; i >= 1; i -= 3)
ans -= arr[i];
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |