@[Yang818](/user/422348) 我也不知道对不对,您的修改是否应该改成
```cpp
for(int i=x;i<=n;i+=lowbit(i))
t[i]+=d;
```
by 未来姚班zyl @ 2023-10-08 17:53:07
```cpp
#include<bits/stdc++.h>
#define F(_b,_e) for(int i=_b;i<=_e;i++)
#define int long long
using namespace std;
inline int read(){
int f=1,x=0;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return f*x;
}
void write(int x) {
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
const int MAXN=1e5+50;
int t[MAXN],n,m;
int lowbit(int x){
return x&-x;
}
int query(int x){
int sum=0;
for(int i=x;i;i-=lowbit(i))
sum+=t[i];
return sum;
}
void modify(int x,int d){
for(int i=x;i<=n;i+=lowbit(i))//
t[i]+=d;
}
signed main(){
//ios::sync_with_stdio(false);
n=read();
m=read();
for(int i=1;i<=m;i++){
int op=read();
if(op==1){
int t=read(),y=read();
modify(t,1);
modify(y+1,1);
}
else{
int t=read();
cout<<(query(t)&1)<<endl;
}
}
return 0;
}
```
by zyh0516_lucky @ 2023-10-08 17:54:54
@[未来姚班zyl](/user/565742) 啊,感谢,祝你未来考上姚班
by Yang818 @ 2023-10-08 17:55:36
@[2022zhangyuanhao](/user/746930) 感谢感谢
by Yang818 @ 2023-10-08 17:55:57