#include <bits/stdc++.h>
using namespace std;
int main(){
int n, q;
cin>>n>>q;
vector<int> v(n);
int top=0;
for(int i=0; i<n; i++){
cin>>v[i];
top+=v[i];
}
/*
//n=3
if(n==3){
top*=100-q;
top/=100;
sort(v.begin(),v.end());
int ans=v[1]+v[2];
cout<<min(ans,top)<<"\n";
}
*/
//q=0
int ans=0;
if(n>=3){
sort(v.rbegin(),v.rend());
for(int i=0; i<n-2; i+=3){
ans+=v[i]+v[i+1];
}
}
int mod=n%3;
for(int i=n-mod; i<n; i++){
ans+=v[i];
}
cout<<ans<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
336 KB |
Output isn't correct |
5 |
Incorrect |
148 ms |
3408 KB |
Output isn't correct |
6 |
Incorrect |
148 ms |
3900 KB |
Output isn't correct |
7 |
Incorrect |
121 ms |
3288 KB |
Output isn't correct |
8 |
Incorrect |
122 ms |
3152 KB |
Output isn't correct |
9 |
Incorrect |
142 ms |
3408 KB |
Output isn't correct |
10 |
Incorrect |
146 ms |
3528 KB |
Output isn't correct |