# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
858354 |
2023-10-08T08:30:50 Z |
ily2003 |
Akcija (COCI15_akcija) |
C++14 |
|
12 ms |
1372 KB |
#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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
10 ms |
1112 KB |
Output is correct |
7 |
Correct |
6 ms |
1240 KB |
Output is correct |
8 |
Correct |
6 ms |
1112 KB |
Output is correct |
9 |
Correct |
12 ms |
1372 KB |
Output is correct |
10 |
Correct |
12 ms |
1372 KB |
Output is correct |