#include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) typedef long long ll; #define MIN(a, b) ((a)>(b)? (b): (a)) #define MAX(a, b) ((a)<(b)? (b): (a)) #define LINF 9223300000000000000 #define INF 2140000000 const long long MOD = 1000000007; //const long long MOD = 998244353; using namespace std; int main(int argc, char* argv[]) { int n; scanf("%d", &n); vector cnt0(n), cnt1(n); ll prev; int i; for(i=0; i0) { cnt0[i]=cnt0[i-1]+(tmpprev? 1:0); } prev=tmp; } int Q; scanf("%d", &Q); for(i=0; i