# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1076848 |
2024-08-26T17:18:13 Z |
toast12 |
Akcija (COCI15_akcija) |
C++14 |
|
24 ms |
1372 KB |
#include <bits/stdc++.h>
using namespace std;
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());
int 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 |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
16 ms |
1116 KB |
Output is correct |
7 |
Correct |
13 ms |
1116 KB |
Output is correct |
8 |
Correct |
19 ms |
1228 KB |
Output is correct |
9 |
Correct |
24 ms |
1372 KB |
Output is correct |
10 |
Incorrect |
21 ms |
1372 KB |
Output isn't correct |