Submission #555188

# Submission time Handle Problem Language Result Execution time Memory
555188 2022-04-30T09:15:24 Z new_acc Akcija (COCI15_akcija) C++14
80 / 80
32 ms 1252 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define pitem item*
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=1e6+10;
const int SS=1<<19;
const int INFi=2e9;
const ll INFl=1e13;
const ll mod2=998244353;
const ll mod=1e9+7;
const ll mod3=1000696969;
const ll p=70032301;
const ull p2=913;
const int L=20;
int t[N];
void solve(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>t[i];
    sort(t+1,t+1+n);
    int res=0;
    for(int i=n;i>=1;i-=3) res+=t[i]+t[i-1]; 
    cout<<res<<"\n";
}
int main(){
    int tt=1;
    while(tt--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 25 ms 1000 KB Output is correct
7 Correct 22 ms 976 KB Output is correct
8 Correct 21 ms 1008 KB Output is correct
9 Correct 32 ms 1140 KB Output is correct
10 Correct 32 ms 1252 KB Output is correct