답안 #251645

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
251645 2020-07-22T06:05:26 Z VEGAnn Akcija (COCI15_akcija) C++14
80 / 80
26 ms 1280 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100100;
int n, a[N];

int main() {
#ifdef _LOCAL
    freopen("in.txt","r",stdin); // freopen("output.txt","w",stdout);
#else
//    freopen("mining.in","r",stdin); freopen("mining.out","w",stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> a[i];

    sort(a, a + n);
    reverse(a, a + n);

    ll ans = 0;

    for (int i = 0; i < n; i++)
        if (i % 3 != 2)
            ans += a[i];

    cout << ans;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 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 9 ms 1280 KB Output is correct
8 Correct 10 ms 1152 KB Output is correct
9 Correct 22 ms 1280 KB Output is correct
10 Correct 26 ms 1280 KB Output is correct