Submission #94011

#TimeUsernameProblemLanguageResultExecution timeMemory
94011theknife2001Akcija (COCI15_akcija)C++17
80 / 80
37 ms1272 KiB
#include <bits/stdc++.h> using namespace std; const int N=1e5+55; int a[N]; int main() { int n; cin>>n; for(int i=0;i<n;i++) cin>>a[i]; sort(a,a+n); long long ans=0; for(int i=n-1;i>=0;i-=3) { ans+=a[i]; if(i-1>=0) ans+=a[i-1]; } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...