Help me in solving SUBSETSUM problem

My issue

I m getting wrong output

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int n;
	cin>>n;
	int x;
	cin>>x;
	int arr[n];
	for(int i=0;i<n;i++){
	    if(arr[i]+arr[i+1]!=x){
	       // cout<<"YES"<<endl;
	    }
	   // cout<<"NO";
	   // else{
	   //     cout<<"YES"<<endl;
	   // }
	}
	cout<<"NO"<<endl;
	return 0;
}

Learning course: Chitkara DSA Bootcamp
Problem Link: CodeChef: Practical coding for everyone

@niyati1137be21
Your logic is not right.
Hint :- think of recursion and dp to solve this problem