# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113064 | CaQtiml | Akcija (COCI15_akcija) | C++14 | 46 ms | 1536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
int arr[(int)1e5+10];
long long qs[(int)1e5+10];
int main()
{
int n;
cin >> n;
int rob = n/3;
for(int i=1;i<=n;i++)
{
cin >> arr[i];
qs[i]=qs[i-1]+arr[i];
}
sort(arr+1,arr+1+n);
long long ans=0;
for(int i=1;i<=rob;i++)
{
ans+=arr[((i-1)*3)+1];
//cout << ans << "\n";
}
//for(int i=(3*rob+1);i<=n;i++) ans+=arr[i];
cout << qs[n]-ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |