Language: C++

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v; ll w; };

ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (-v[x] < -v[y]) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

vector<int> f(int N, int M, vector<int> dx) {
	vector<vector<int> > nxt(N + 1, vector<int>(M));
	rep(j, M) nxt[N][j] = nxt[N - 1][j] = N;
	for (int i = N - 2; i >= 0; i--) {
		nxt[i] = nxt[i + 1];
		for (int j = dx[i]; j < M; j++) nxt[i][j] = i + 1;
	}
	vector<int> dp(1<<M);
	rep(S, 1<<M)
		rep(j, M) if (!(S>>j & 1)) {
			int _S = S | 1<<j;
			dp[_S] = max(dp[_S], nxt[dp[S]][j]);
		}
	return dp;
}

vector<int> solve() {
	int N, V; cin >> N >> V;
	vector<int> x(N);
	rep(i, N) scanf("%d", &x[i]);
	vector<int> dx(N - 1);
	rep(i, N - 1) dx[i] = x[i + 1] - x[i];
	bool ok = true;
	rep(i, N - 1) if (dx[i] > V) ok = false;
	if (ok) return vector<int>(N, true);
	vector<int> v;
	for (int _V = V; _V; _V /= 2) v.pb(_V);
	v.pb(0);
	int M = v.size();
	rep(i, N - 1) {
		int k;
		for (k = 0; dx[i] <= v[k]; k++);
		dx[i] = k;
	}
	union_find uf(N);
	rep(i, N - 1) if (dx[i]) uf.unite(i, i + 1);
	vector<int> dp1 = f(N, M, dx);
	reverse(dx.begin(), dx.end());
	vector<int> dp2 = f(N, M, dx);
	vector<bool> ok(N);
	rep(S, 1<<(M - 1)) {
		int S1 = S<<1, S2 = (((1<<(M - 1)) - 1) - S)<<1;
		int i = min(dp1[S1], N - 1), j = max(0, N - 1 - dp2[S2]);
		if (uf.same(i, j)) ok[uf.find(i)] = true;
	}
	vector<int> ans(N);
	rep(i, N) ans[i] = ok[uf.find(i)];
	return ans;
}

int main() {
	vector<int> ans = solve();
	for (int z: ans) if (z) printf("Possible\n"); else printf("Impossible\n");
}


Compiler output:
a.cc: In function 'std::vector<int> solve()':
a.cc:94:22: error: conflicting declaration 'std::vector<bool> ok'
   94 |         vector<bool> ok(N);
      |                      ^~
a.cc:77:14: note: previous declaration as 'bool ok'
   77 |         bool ok = true;
      |              ^~
a.cc:98:38: error: invalid types 'bool[int]' for array subscript
   98 |                 if (uf.same(i, j)) ok[uf.find(i)] = true;
      |                                      ^
a.cc:101:30: error: invalid types 'bool[int]' for array subscript
  101 |         rep(i, N) ans[i] = ok[uf.find(i)];
      |                              ^