Submission #357893

#TimeUsernameProblemLanguageResultExecution timeMemory
357893beepbeepsheepAkcija (COCI15_akcija)C++17
80 / 80
18 ms1644 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll bignum=1e17; const int inf= 2e9; const int mod= 1e9+7; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin>>n; ll arr[n]; for (int i=0;i<n;i++){ cin>>arr[i]; } sort(arr,arr+n); reverse(arr,arr+n); ll ans=0; for (int i=0;i<n;i++){ if (!((i+1)%3))continue; ans+=arr[i]; } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...