# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154267 | radugheo | Akcija (COCI15_akcija) | C++14 | 61 ms | 1372 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;
int n, i, sum, v[100005];
int main(){
cin >> n;
for (i=1; i<=n; i++){
cin >> v[i];
}
sort (v, v + n + 1);
for (i=n; i>=1; i--){
sum += v[i];
if (n%3 == 0){
if (i%3 == 1){
sum -= v[i];
}
}
else if (n%3 == 1){
if (i%3 == 2){
sum -= v[i];
}
}
else{
if (i%3 == 0){
sum -= v[i];
}
}
}
cout << sum;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |