#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main()
{
int n ;
cin >> n ;
int a[n] , total=0 ;
for(int i=0;i<n;i++)cin>>a[i] ,total+=a[i];
sort(a,a+n) ;
for(int i=0;i<n;i+=3)total-=a[i] ;
if(n%3==0)
cout<<total<<endl;
else cout<<total+a[n-1];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
29 ms |
980 KB |
Output is correct |
7 |
Correct |
23 ms |
1080 KB |
Output is correct |
8 |
Correct |
22 ms |
980 KB |
Output is correct |
9 |
Incorrect |
30 ms |
1176 KB |
Output isn't correct |
10 |
Incorrect |
31 ms |
1240 KB |
Output isn't correct |