| 比赛 |
2026.9.12 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
画线 |
最终得分 |
100 |
| 用户昵称 |
默 |
运行时间 |
0.836 s |
| 代码语言 |
C++ |
内存使用 |
13.31 MiB |
| 提交时间 |
2026-09-12 10:18:24 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int n,q;
inline int read(){
int t=0,f=1;
register char c=getchar();
while(c<'0'||c>'9') f=(c=='-')?(-1):(f),c=getchar();
while(c>='0'&&c<='9') t=(t<<3)+(t<<1)+(c^48),c=getchar();
return t*f;
}
#define pr pair<int,int>
pr operator +(const pr &x,const pr &y){
pr z;
z.first=max(x.first,y.first),z.second=min(x.second,y.second);
return z;
}
struct Tree{
#define mid (l+r>>1)
pr tr[N<<2];
void build(int p,int l,int r){
tr[p]={1,n};
if(l==r) return;
build(p<<1,l,mid),build(p<<1|1,mid+1,r);
}
void update(int p,int l,int r,int L,int R){
if(L<=l&&R>=r) return (void)(tr[p]=tr[p]+make_pair(L,R));
if(L<=mid) update(p<<1,l,mid,L,R);
if(R>mid) update(p<<1|1,mid+1,r,L,R);
}
bool query(int p,int l,int r,int x,int y){
if(y<tr[p].first||y>tr[p].second) return false;
if(l==r) return true;
if(x<=mid) return query(p<<1,l,mid,x,y);
return query(p<<1|1,mid+1,r,x,y);
}
#undef mid
}Tr;
signed main(){
freopen("circle.in","r",stdin);
freopen("circle.out","w",stdout);
n=read(),q=read(),Tr.build(1,1,n);
while(q--){
int x=read(),y=read();
if(x>y) swap(x,y);
if(!Tr.query(1,1,n,x,y)||!Tr.query(1,1,n,y,x)) cout<<"No\n";
else{
cout<<"Yes\n";
Tr.update(1,1,n,x,y);
}
}
return 0;
}