Submission #294521

#TimeUsernameProblemLanguageResultExecution timeMemory
2945217_7_7Akcija (COCI15_akcija)C++17
80 / 80
18 ms1280 KiB
#include <bits/stdc++.h> using namespace std; int n; int main() { ios_base::sync_with_stdio(false); cin >> n; vector<int> a(n); for(auto &x: a) cin >> x; sort(a.begin(), a.end()); long long res = accumulate(a.begin(), a.end(), 0ll); int cur = (int)a.size() - 3; while(cur >= 0){ res -= a[cur]; cur -= 3; } cout << res << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...