Pagini recente » Monitorul de evaluare | Cod sursa (job #238976) | CLASAMENTUL!! | Monitorul de evaluare | Cod sursa (job #2020091)
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
freopen("loto.in","r",stdin);
freopen("loto.out","w",stdout);
int n , s , i , nr;
scanf("%d%d",&n,&s);
vector<int>v;
for(i=0;i<n;i++)
{
scanf("%d",&nr);
v.push_back(nr);
}
sort(v.begin(),v.end());
vector<int>::iterator it ,it1;
it=v.end()-1;
it1=v.begin();
if((*it)*6<s)
{
printf("-1");
return 0;
}
if((*it1)*6>s)
{
printf("-1");
return 0;
}
i=6;
while(i)
{
nr=s/i;
if(s%i!=0)nr++;
it=lower_bound(v.begin(),v.end(),nr);
s-=nr;
printf("%d ",*it);
i--;
}
printf("\n");
return 0;
}