#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 0x3f3f3f3f
const int mod=1e9+7;
const int N=2e5+5;
int n,m;
map<int,int>a,b,c1,c2;
void solve(){
cin>>n>>m;
while(m--){
int x,y;
cin>>x>>y;
if(a.count(x)||b.count(y)){
cout<<"No"<<endl;
}
else{
if(c1.count(y-x)||c2.count(y-(n+1-x))){
cout<<"No"<<endl;
}
else{
cout<<"Yes"<<endl;
a[x]=1,b[y]=1;
c1[y-x]=1;
c2[y-(n+1-x)]=1;
}
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt=1;
// cin>>tt;
while(tt--) solve();
return 0;
}
n皇后问题(思维&模拟)---2023年天梯赛(GPLT)上海理工大学校内选拔赛-C
最新推荐文章于 2024-09-27 14:28:55 发布