Result: Accepted
Time: 54ms
Memory: 2496kB
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
const int maxn=1e5+7;
long long a[maxn];
long long b[10];
int main()
{
long long n,k;
scanf("%lld%lld",&n,&k);
for(int i=0;i<n;i++)
scanf("%lld",&a[i]);
for(int i=0;i<n;i++)
{
if(a[i]<=1)
{
if(k==1)a[i]=10;
else if(k==2)a[i]=40;
else if(k==3)a[i]=70;
else if(k==4)a[i]=90;
else
a[i]=100;
}
else if(a[i]>=2&&a[i]<=4)
{
if(k==1)a[i]=20;
else if(k==2)a[i]=50;
else if(k==3)a[i]=80;
else if(k==4)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=9&&a[i]>4)
{
if(k==1)a[i]=30;
else if(k==2)a[i]=60;
else if(k==3)a[i]=80;
else if(k==4)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=16&&a[i]>9)
{
if(k==1)a[i]=40;
else if(k==2)a[i]=70;
else if(k==3)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=25&&a[i]>16)
{
if(k==1)a[i]=50;
else if(k==2)a[i]=80;
else if(k==3)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=36&&a[i]>25)
{
if(k==1)a[i]=60;
else if(k==2)a[i]=80;
else if(k==3)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=49&&a[i]>36)
{
if(k==1)a[i]=70;
else if(k==2)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=64&&a[i]>49)
{
if(k==1)a[i]=80;
else if(k==2)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=81&&a[i]>64)
{
if(k==1)a[i]=90;
else
a[i]=100;
}
else if(a[i]<=100&&a[i]>81)
{
a[i]=100;
}
}
printf("%lld",a[0]);
for(int i=1;i<n;i++)
printf(" %lld",a[i]);
printf("\n");
}