답안 #1076848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1076848 2024-08-26T17:18:13 Z toast12 Akcija (COCI15_akcija) C++14
56 / 80
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;
}
# 결과 실행 시간 메모리 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