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<stdio.h>
#include<algorithm>
using namespace std;
typedef pair<int, int> pii;
int n, m;
int a[100009];
pii b[100009];
int c[100009];
int main()
{
int i, j, k, l;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){scanf("%d",&a[i]);b[i].first=a[i];b[i].second = i;}
sort(b,b+n);
for(i=0;i<m;i++)
c[b[n-i-1].second]=1;
for(i=0;i<n;i++)
if(c[i]==0)
printf("%d ",a[i]);
for(i=0;i<m;i++)
printf("%d ",b[i+n-m].first);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |