Result: Accepted
Time: 299ms
Memory: 1900kB
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int n,k,i,j,m;
double *a;
double b[101];
scanf("%d%d",&n,&k);
a=(double *)malloc(n*sizeof(double));
memset(b,0,sizeof(b));
for(i=0;i<n;++i)
scanf("%lf",&a[i]);
m=a[0];
for(i=1;i<=k;++i)
a[0]=10*ceil(sqrt(a[0]));
printf("%.0f ",a[0]);
b[m]=a[0];
for(i=1;i<n;++i)
{
m=a[i];
if(b[m]!=0)
a[i]=b[m];
else
{
for(j=1;j<=k;++j)
{
a[i]=10*ceil(sqrt(a[i]));
}
b[m]=a[i];
}
if(i!=n-1)
printf("%.0f ",a[i]);
else
printf("%.0f\n",a[i]);
}
return 0;
}