//#include<fstream>
#include<algorithm>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("karte.in");
//ofstream fout("karte.out");
int n,v[100001],i;
long long sol;
int main()
{
fin>>n;
for(i=1;i<=n;i++){fin>>v[i];sol+=v[i];}
sort(v+1,v+n+1);
for(i=n-2;i>=1;i-=3) sol-=v[i];
fout<<sol;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
46 ms |
1144 KB |
Output is correct |
7 |
Correct |
42 ms |
1144 KB |
Output is correct |
8 |
Correct |
41 ms |
1028 KB |
Output is correct |
9 |
Correct |
62 ms |
1272 KB |
Output is correct |
10 |
Correct |
60 ms |
1220 KB |
Output is correct |