Submission #374070

#TimeUsernameProblemLanguageResultExecution timeMemory
374070NimbostratusAkcija (COCI15_akcija)C++17
80 / 80
18 ms1388 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ub upper_bound #define lb lower_bound #define clean(a,s) memset((a),0,sizeof((a)[0])*(s)) #define all(x) (x).begin() , (x).end() #define fi first #define se second #define int int using pii = pair<int,int>; using ll = long long; const int maxn = 2e5+5; const int inf = 2e9; const int mod = 1e9+7; int n,a[maxn]; ll ans; int32_t main () { //freopen("in","r",stdin); freopen("out","w",stdout); ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cin >> n; for(int i=1;i<=n;i++) cin >> a[i]; sort(a+1,a+n+1); for(int i=1;i<=n;i++) ans += a[i]; for(int i=n;i>=3;i-=3) ans -= a[i-2]; cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...