답안 #294521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
294521 2020-09-09T03:33:49 Z 7_7_7 Akcija (COCI15_akcija) C++17
80 / 80
18 ms 1280 KB
#include <bits/stdc++.h>

using namespace std;

int n;
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n;
    vector<int> a(n);
    for(auto &x: a) cin >> x;

    sort(a.begin(), a.end());
    long long res = accumulate(a.begin(), a.end(), 0ll);
    int cur = (int)a.size() - 3;
    while(cur >= 0){
        res -= a[cur];
        cur -= 3;
    }
    cout << res << "\n";
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 15 ms 1152 KB Output is correct
7 Correct 10 ms 1152 KB Output is correct
8 Correct 11 ms 1152 KB Output is correct
9 Correct 18 ms 1280 KB Output is correct
10 Correct 18 ms 1280 KB Output is correct