답안 #1101717

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1101717 2024-10-16T16:55:03 Z ardadut Akcija (COCI15_akcija) C++17
80 / 80
14 ms 1616 KB
#include <bits/stdc++.h>
    
#define ll long long
#define pb push_back
#define endl "\n";
#define vec vector<ll>
#define vecvec vector<vector<ll>>
    
using namespace std;
    
/*#define FileName "connect"
string Ghhhh = ".in";
string Ghhhhh = ".out";
ifstream Girdi(FileName + Ghhhh);
ofstream Cikti(FileName + Ghhhhh);
#define cin Girdi
#define cout Cikti*/


bool comp(ll a, ll b){
    return a > b;
}

inline void solve(){

    ll n;
    cin >> n;

    vector<ll> arr(n);
    ll sum = 0;

    for(ll i = 0 ; i < n ; i++){
        cin >> arr[i];
        sum += arr[i];
    }

    sort(arr.begin(),arr.end(),comp);

    for(ll i = 0 ; i < n ; i++){
        if(i % 3 == 2) sum -= arr[i];
    }

    cout << sum << endl;
    
}
    
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 424 KB Output is correct
6 Correct 13 ms 1616 KB Output is correct
7 Correct 8 ms 1616 KB Output is correct
8 Correct 9 ms 1616 KB Output is correct
9 Correct 14 ms 1616 KB Output is correct
10 Correct 14 ms 1616 KB Output is correct