# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
858354 | ily2003 | Akcija (COCI15_akcija) | C++14 | 12 ms | 1372 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 n,tong,dem,a[100001];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.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%3;++i) tong+=a[i];
dem=2;
for (int i=n%3+1;i<=n;++i) {
++dem;
if (dem==3) {
dem=0;
continue;
}
tong+=a[i];
}
cout << tong;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |