| 比赛 |
2026.9.12 |
评测结果 |
AAAAAAAAAA |
| 题目名称 |
画线 |
最终得分 |
100 |
| 用户昵称 |
VTXE |
运行时间 |
0.641 s |
| 代码语言 |
C++ |
内存使用 |
7.66 MiB |
| 提交时间 |
2026-09-12 11:25:35 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,q;
ll a[1100000];
mt19937_64 rnd(time(0));
void add(ll o,ll v){
for (;o<=n;o+=o&-o){
a[o]^=v;
}
}
ll query(ll o){
ll res=0;
for (;o;o-=o&-o){
res^=a[o];
}
return res;
}
int main(){
freopen("circle.in","r",stdin);
freopen("circle.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>q;
while (q--){
ll x,y;
cin>>x>>y;
if (x>y) swap(x,y);
ll res=query(y)^query(x);
if (res==0){
cout<<"Yes\n";
ll v=rnd();
add(x,v);
add(y,v);
}else{
cout<<"No\n";
}
}
return 0;
}