题目链接:CF1293C
code:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
bitset<maxn> m1, m1l, m1r, m2;
int main()
{
ios::sync_with_stdio(false);
int n, q;
int r, c;
cin >> n >> q;
int i;
for (i = 0; i < q; i++)
{
cin >> r >> c;
if (r == 1)
{
m1.flip(c);
if (c > 1)
m1l.flip(c - 1);
if (c < n)
m1r.flip(c + 1);
}
else
m2.flip(c);
if ((m1 & m2).none() && (m1l & m2).none() && (m1r & m2).none())
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
return 0;
}
来源:CSDN
作者:jiangxiaoju
链接:https://blog.csdn.net/qq_43058685/article/details/104063954