# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168873 | Asamu13 | Akcija (COCI15_akcija) | C++14 | 22 ms | 2036 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>
#define inf INT_MAX
#define sc(a) scanf("%d",&a)
#define scc(a,b) scanf("%d %d",&a,&b)
#define sccc(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pf(a) printf("%d",a)
#define pff(a,b) printf("%d %d",a,b)
#define pfff(a,b,c) printf("%d %d %d",a,b,c)
#define pb(a) push_back(a)
#define em empty()
#define fr front()
#define cl clear()
#define sz size()
#define mp(a,b) make_pair(a,b)
#define fri(b) freopen(b,"r",stdin)
#define fro(b) freopen(b,"w",stdout)
/*
ID: uslusam1
TASK: test
LANG: C++
*/
using namespace std;
vector<long long> vec;
long long ans;
int main(){
//fri("gir.txt");
//fro("cik.txt");
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
for(int i=1;i<=n;i++){
long long k;
cin>>k;
vec.pb(k);
}
sort(vec.begin(),vec.end());
int cnt=0;
for(int i=vec.size()-1;i>=0;i--){
if(cnt%3!=2){
ans+=vec[i];
}
cnt++;
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |