Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int N,Q;
- while(cin>>N>>Q)
- {
- bool type[N]={0};
- for(int i=0;i<Q;i++)
- {
- int v,R,L,change;
- cin>>v;
- if(v==1)
- {
- cin>>change;
- if(type[change-1])
- type[change-1]=0;
- else
- type[change-1]=1;
- }
- else
- {
- bool ans=0;
- cin>>L>>R;
- for(int j=R;j>L;j--)
- {
- if(type[j-1])
- {
- if(ans==1)
- ans=0;
- else
- ans=1;
- }
- }
- cout<<ans<<endl;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment