# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
270420 | 2020-08-17T15:11:47 Z | leductoan | Akcija (COCI15_akcija) | C++14 | 22 ms | 1408 KB |
#include<bits/stdc++.h> using namespace std; #define task "" #define BIT(x, i) (((x) >> (i)) & 1) #define lb lower_bound #define ub upper_bound #define lla(v) (v).begin(),(v).end() #define zs(v) (v).size() #define fi first #define se second #define pb push_back typedef long double ld; typedef long long ll; typedef pair<int,int> pii; const int mod=1000000007; /// 998244353 const int base=311; const int N=1e5+5; int n,a[N]; void solved() { cin>>n; for(int i=1;i<=n;++i) cin>>a[i]; sort(a+1,a+n+1,greater<int>()); ll ans=0; for(int i=1;i<=n;i+=3) ans+=a[i]+a[i+1]; cout<<ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } solved(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 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 | 14 ms | 1152 KB | Output is correct |
7 | Correct | 9 ms | 1152 KB | Output is correct |
8 | Correct | 10 ms | 1152 KB | Output is correct |
9 | Correct | 22 ms | 1408 KB | Output is correct |
10 | Correct | 20 ms | 1280 KB | Output is correct |