Submission #1076854

#TimeUsernameProblemLanguageResultExecution timeMemory
1076854toast12Akcija (COCI15_akcija)C++14
80 / 80
23 ms1392 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; ll ans = 0; vector<int> nums(n); for (int i = 0; i < n; i++) { cin >> nums[i]; ans += nums[i]; } sort(nums.begin(), nums.end()); reverse(nums.begin(), nums.end()); for (int i = 0; i < n; i++) { if (i % 3 == 2) ans -= nums[i]; } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...