题目
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn];
void solve(){
int n, q, i, j;
cin >> n >> q;
int sum = 0;
set<int> S;//1的下标集合
for(i = 1; i <= n; i++){
cin >> a[i];
if(a[i] == 1) S.insert(i);
sum += a[i];
}
while(q--){
int op, x, y;
cin >> op;
if(op == 1){
cin >> x;
int lst = 0, rst = 0, cnt, maxx = 0;
if(S.size()){
lst = *S.begin(), rst = *S.rbegin();//找最左端的1和最右端的1,看哪个离端点最近,该1的位置到端点的区间和为maxx,那么[1, maxx]的询问都能满足
cnt = min(lst - 1, n - rst);
maxx = sum - 2 * cnt;
}
if(x <= maxx) cout << "Yes\n";
else{
if((x + sum) % 2 == 0 && x <= sum){//大于maxx的话,得小于等于sum且与sum奇偶性相同(只能-2,-2...)
cout << "Yes\n";
}
else cout << "No\n";
}
}
else{
cin >> x >> y;
if(a[x] != y){
a[x] = y;
if(y == 1){
S.insert(x);
sum--;
}
else{
S.erase(x);
sum++;
}
}
}
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while(T--){
solve();
}
return 0;
}