# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153861 | AlexPascu007 | Akcija (COCI15_akcija) | C++98 | 66 ms | 1220 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 <iostream>
#include <algorithm>
using namespace std;
long long n,i,c[100010],s;
int main() {
cin>>n;
for (i=1;i<=n;i++)
cin>>c[i];
sort(c+1,c+n+1);
for (i=n;i>=1;i--) {
s+=c[i];
if (n%3==0) {
if (i%3==1)
s-=c[i];
}
else if (n%3==1) {
if (i%3==2)
s-=c[i];
}
else if (n%3==2) {
if (i%3==0)
s-=c[i];
}
}
cout<<s;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |