Test instructions and analysis (codeforces 540B) code
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #define MP make_ Pair#define PB push_back#define fi first#define se second#define ZERO (x) memset ((x), 0, sizeof (x)) #define ALL (x) (x). Begin (), (x). End () #define REP (I, A, b) for (Int. i = (a); I <= (b); ++i) #define PER (I, a, b) for (int i = (a); I >= (b);-- i) #define Quickio Ios::sync_with_stdio (FALSE); Cin.tie (0); Cout.tie (0); using namespace Std;int main () {int n,k,p,x,y; cin>>n>>k>>p>>x>>y; int nowtot=0,belowycnt=0; int arr[1005]; Rep (i,1,k) {cin>>arr[i]; nowtot+=arr[i]; if (arr[i]<y) belowycnt++;} int Restmark=x-nowtot; if (nowtot+n-k>x | | belowycnt>n/2) cout<<-1<<endl; else {int geycnt=k-belowycnt; Vector<int> VEC; Rep (i,k+1,n) {if (BELOWYCNT<N/2) {restmark--; if (restmark>=0) {Vec. PB (1); belowycnt++; }} else {restmark-=y; if (restmark>=0) Vec. PB (y); } if (restmark<=0) break; } if (Vec.size () ==n-k) {for (auto It:vec) cout<<it<< ""; cout<<endl; } else cout<<-1<<endl; } return 0;}
Daily training "school Marks (codeforces Round 301 Div.2 B)