답안 #1005465

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005465 2024-06-22T13:17:55 Z vjudge1 Akcija (COCI15_akcija) C++17
80 / 80
21 ms 1728 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
    int n; cin>>n;
    vector<int> c(n);
    for (int i=0; i<n; i++) cin>>c[i];
    sort(c.begin(),c.end(),greater<int>());
    int ans=0;
    for (auto i: c) ans+=i;
    for (int i=2; i<n; i+=3){
        
        ans-=c[i];
    }
    cout<<ans<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
6 Correct 16 ms 1604 KB Output is correct
7 Correct 15 ms 1372 KB Output is correct
8 Correct 13 ms 1620 KB Output is correct
9 Correct 21 ms 1628 KB Output is correct
10 Correct 21 ms 1728 KB Output is correct