# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1076851 |
2024-08-26T17:18:50 Z |
toast12 |
Akcija (COCI15_akcija) |
C++14 |
|
25 ms |
840 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector<int> nums(n);
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
sort(nums.begin(), nums.end());
ll ans = 0;
for (int i = n-1; i > 0; i -= 3) {
ans += nums[i]+nums[i-1];
}
if (n % 3 == 1)
ans += nums[0];
else if (n % 3 == 2)
ans += nums[0]+nums[1];
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
25 ms |
604 KB |
Output is correct |
7 |
Correct |
16 ms |
604 KB |
Output is correct |
8 |
Correct |
13 ms |
840 KB |
Output is correct |
9 |
Correct |
23 ms |
604 KB |
Output is correct |
10 |
Incorrect |
24 ms |
836 KB |
Output isn't correct |