思路:要使得放的成绩的和最小 中位数之前放1 中位数之后放y addf表示在前面需要放的数的个数 addt表示在后面需要放的数的个数
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <cmath>
#include <vector>
#define max_ 1010
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
int n,k,p,x,y;
int num[max_];
int main(int argc, char const *argv[])
{
scanf("%d%d%d%d%d",&n,&k,&p,&x,&y);
int i,sum=0,cnt=0;
for(i=1;i<=k;i++)
{
int z;
scanf("%d",&z);
sum+=z;
if(z<y)
cnt++;
}
if(cnt>n/2)
{
printf("-1\n");
return 0;
}
int addf=min(n-k,n/2-cnt);
int addt=n-k-addf;
if(addf+y*addt>x-sum)
{
printf("-1\n");
return 0;
}
for(i=1;i<=addf;i++)
{
printf("1 ");
}
for(i=1;i<=addt;i++)
{
printf("%d ",y);
}
return 0;
}