Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
585 B
21
Indexable
Never
#include <iostream>

using namespace std;

int main()
{
	int n;
	int z;
	bool flag=true;
	cin >> n >> z;
	int* A = new int(n);
	for (int i = 0; i < n; ++i) {
		cin >> A[i];
	}
	
	
	
	for (int i = 0; i < n; i++) {
		for (int g = 0; g < n - 1; g++) {
			if (A[g] < A[g + 1]) {
				int x = A[g];
				A[g] = A[g + 1];
				A[g + 1] = x;
			} 
		}
	}
	for (int i = 0; i < n; i++) {
		if ((z - A[i]) >= 0) {
			z = z/2;
			flag = true;
		}
		else {
			flag=false;
			break;
		}
	}
	if (flag == true) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}