Submission #1130407

#TimeUsernameProblemLanguageResultExecution timeMemory
1130407AndrijaMAkcija (COCI15_akcija)C++20
80 / 80
14 ms1096 KiB
#include <bits/stdc++.h> using namespace std; #define int long long ///#define endl '\n' const int maxn=2e5+10; const int mod=1e9+7; signed main() { ios::sync_with_stdio(false); ///freopen("dulciuri.in","r",stdin); ///freopen("dulciuri.out","w",stdout); int n; cin>>n; int a[n]; int ans=0; for(int i=0;i<n;i++) { cin>>a[i]; ans+=a[i]; } sort(a,a+n); reverse(a,a+n); for(int i=2;i<n;i+=3) { ans-=a[i]; } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...