Submission #469040

#TimeUsernameProblemLanguageResultExecution timeMemory
469040ala2Akcija (COCI15_akcija)C++14
80 / 80
43 ms1172 KiB
#include <bits/stdc++.h> using namespace std; int a[1001000]; int main() { int n; cin>>n; int g=0; for(int i=1;i<=n;i++) { cin>>a[i]; g+=a[i]; } sort(a+1,a+n+1); reverse(a+1,a+1+n); for(int i=1;i<=n;i++) { if(i%3) continue; g-=a[i]; } cout<<g<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...