답안 #1084067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084067 2024-09-05T03:39:28 Z overwatch9 Akcija (COCI15_akcija) C++17
80 / 80
22 ms 1372 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, x = 2; i >= 0; i--, x--) {
        if (x == -1)
            x = 2;
        if (x == 0)
            continue;
        ans += nums[i];
    }
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 17 ms 1372 KB Output is correct
7 Correct 15 ms 1116 KB Output is correct
8 Correct 13 ms 1204 KB Output is correct
9 Correct 21 ms 1372 KB Output is correct
10 Correct 22 ms 1368 KB Output is correct