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<cstdio>
#include<algorithm>
#include<map>
int a,b,i,j,t,p,q,m,n,s,x[160001],y[160001];
std::map<int,int>D,U;
main()
{
scanf("%d%d",&a,&b);
for(i=0;i<a;i++)
{
scanf("%d",&x[i]);
y[i]=x[i];
U[x[i]]++;
}
std::sort(y,y+a);
for(i=a-b;i<a;i++)
{
D[y[i]]++;
}
for(i=0;i<a;i++)
{
if(D[x[i]]!=U[x[i]])
{
printf("%d ",x[i]);
D[x[i]]++;
}
}
for(i=a-b;i<a;i++)
{
printf("%d ",y[i]);
}
}
# | 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... |