답안 #956172

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956172 2024-04-01T08:47:58 Z lalig777 Akcija (COCI15_akcija) C++14
80 / 80
25 ms 1372 KB
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
    int n; cin>>n;
    ll sum=0;
    vector<int>v(n);
    for (int i=0; i<n; i++){
        cin>>v[i];
        sum+=v[i];
    }sort(v.begin(), v.end());
    for (int i=n-3; i>=0; i-=3) sum-=v[i];
    cout<<sum<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 19 ms 1204 KB Output is correct
7 Correct 16 ms 1112 KB Output is correct
8 Correct 17 ms 1112 KB Output is correct
9 Correct 25 ms 1372 KB Output is correct
10 Correct 25 ms 1368 KB Output is correct