# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95102 | karlopuh | Akcija (COCI15_akcija) | C++14 | 39 ms | 1396 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;
vector <int> niz;
int n,iznos;
int main(){
cin>>n;
for(int i=0;i<n;i++){
int broj;
cin>>broj;
niz.push_back(broj);
}
sort(niz.begin(),niz.end());
for(int i=niz.size()-1;i>=0;i-=3){
if(i==0){
iznos+=niz[0];
}else if(i==1){
iznos+=niz[0]+niz[1];
}
else{
iznos+=niz[i];
iznos+=niz[i-1];
}
}
cout<<iznos;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |