/* Problem URL: https://codeforces.com/problemset/problem/1896/D */ #include #include #include using namespace std; using namespace __gnu_pbds; template > using ordered_set = tree; #define V vector #define rmin(a, b) a = min(a, b) #define rmax(a, b) a = max(a, b) #define rep(i, lim) for (int i = 0; i < (lim); i++) #define nrep(i, s, lim) for (int i = s; i < (lim); i++) #define repv(i, v) for (auto &i : (v)) #define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; } #define sortv(v) sort(v.begin(), v.end()) #define all(v) (v).begin(), (v).end() using vi = vector; using vvi = vector; using vvvi = vector; using vvvvi = vector; using ll = long long; using vl = vector; using vvl = vector; using vvvl = vector; using vvvvl = vector; template auto operator<<(ostream &os, const vector &vec)->ostream& { os << vec[0]; for (size_t i = 1; i < vec.size(); i++) { os << ' ' << vec[i]; } os << '\n'; return os; } template auto operator>>(istream &is, vector &vec)->istream& { for (auto &i : vec) { is >> i; } return is; } template auto operator<<(ostream &os, const vector> &vec)->ostream& { for (auto &i : vec) { os << i[0]; for (size_t j = 1; j < i.size(); j++) { os << ' ' << i[j]; } os << '\n'; } return os; } template auto operator>>(istream &is, vector> &vec)->istream& { for (auto &i : vec) { for (auto &j : i) { is >> j; } } return is; } const int oo = INT32_MAX >> 1; const ll OO = INT64_MAX >> 1; void pre() { } #define TEST 1 void solve() { int n, q; cin >> n >> q; vi a(n); cin >> a; while (__builtin_popcount(n) != 1) { n++; a.push_back(0); } set ones; rep(i, n) { if (a[i] == 1) { ones.insert(i); } } vi seg(n << 1); nrep(i, n, n << 1) { seg[i] = a[i - n]; } for (int i = n - 1; i > 0; i--) { seg[i] = seg[i * 2] + seg[i * 2 + 1]; } auto update = [&](int i, int v) { i += n; seg[i] = v; for (i >>= 1; i > 0; i >>= 1) { seg[i] = seg[i * 2] + seg[i * 2 + 1]; } }; function query = [&](int i, int l, int r, int tl, int tr) { if (l > tr || r < tl) { return 0; } if (l >= tl && r <= tr) { return seg[i]; } int mid = (l + r) >> 1; return query(i * 2, l, mid, tl, tr) + query(i * 2 + 1, mid + 1, r, tl, tr); }; int l1 = -1; int r1 = -1; if (!ones.empty()) { l1 = *ones.begin(); r1 = *prev(ones.end()); } while (q--) { int op; cin >> op; if (op == 2) { int i, v; cin >> i >> v; i--; if (a[i] == 1) { ones.erase(i); } a[i] = v; update(i, v); if (v == 1) { ones.insert(i); } if (!ones.empty()) { l1 = *ones.begin(); r1 = *prev(ones.end()); } else { l1 = -1; r1 = -1; } continue; } int s; cin >> s; if (s & 1) { if (l1 == -1) { cout << "NO\n"; continue; } if (ones.size() & 1) { cout << (query(1, 0, n - 1, 0, n - 1) >= s ? "YES\n" : "NO\n"); continue; } int ans = max(query(1, 0, n - 1, 0, r1 - 1), query(1, 0, n - 1, l1 + 1, n - 1)); cout << (ans >= s ? "YES\n" : "NO\n"); continue; } if (ones.size() & 1) { int ans = max(query(1, 0, n - 1, 0, r1 - 1), query(1, 0, n - 1, l1 + 1, n - 1)); cout << (ans >= s ? "YES\n" : "NO\n"); continue; } cout << (query(1, 0, n - 1, 0, n - 1) >= s ? "YES\n" : "NO\n"); } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); pre(); int t; (TEST && cin >> t) || (t = 1); while (t--) { solve(); } }