这道题一上来可以发现,是用线段树维护$F_{a_i}$,可是我不会求$F_{a_i}$,因此,此题有前置知识,须做[P1962](https://www.luogu.com.cn/problem/P1962)。
昨晚P1962,这道题就简单了,直接上代码!
```cpp
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll int
/*====================*/
const int N=1e6+10;
/*====================*/
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
/*====================*/
int n,q,b[N];
struct A{
int a[2][2];
void clear(){
for(int i=0;i<2;i++){
for(int j=0;j<2;j++)a[i][j]=0;
}
return;
}
void init(){
a[0][0]=a[1][1]=1;
return;
}
bool empty(){
if(a[0][1]==0&&a[1][0]==0&&a[0][0]==1&&a[1][1]==1)return 1;
return 0;
}
A operator+(const A &b)const{
A c;
c.clear();
for(int i=0;i<2;i++){

最低0.47元/天 解锁文章
1019

被折叠的 条评论
为什么被折叠?



