Submission #165017

#TimeUsernameProblemLanguageResultExecution timeMemory
165017Rouge_HugoAkcija (COCI15_akcija)C++14
80 / 80
67 ms1300 KiB
#include <bits/stdc++.h> #define ll long long #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; int n; int a[100009]; int main() { cin>>n; ll sum=0; for(int i=0;i<n;i++)cin>>a[i]; sort(a,a+n); int re=0; for(int i=n-1;i>-1;i--) { re%=3; if (re==2){re++;continue;} sum+=a[i]; re++; } cout<<sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...