답안 #141429

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
141429 2019-08-08T04:48:09 Z meatrow Akcija (COCI15_akcija) C++17
80 / 80
36 ms 1272 KB
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> c(n);
    for (int& i : c) {
        cin >> i;
    }
    sort(c.begin(), c.end());
    ll ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        if ((n - i) % 3) {
            ans += c[i];
        }
    }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 416 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 17 ms 1144 KB Output is correct
7 Correct 13 ms 1064 KB Output is correct
8 Correct 13 ms 1144 KB Output is correct
9 Correct 36 ms 1272 KB Output is correct
10 Correct 21 ms 1272 KB Output is correct