CCCPaste

Untitled

#include 
#include 
using namespace std;
vectorv;
int m;
int n;
int dp[1010][55];

int rec(int scena_i, int pos_i ){

    if((scena_i<0)or(scena_i>m)){
        return -1;
    }


    if(pos_i==n){
        return(scena_i);
    }



    if(dp[scena_i][pos_i]!=-1){
        return(dp[scena_i][pos_i]);
    }

    int result=-1;

    result=max(result, rec(scena_i-v[pos_i], pos_i+1));
    result=max(result, rec(scena_i+v[pos_i], pos_i+1));


    dp[scena_i][pos_i]=result;

    return(result);




}
int main()
{

int p;

cin>>p>>m;

cin>>n;

for(int i=0; i>a;
    v.push_back(a);


}

for(int i=0; i<1010; i++){
    for(int j=0; j