| 比赛 |
2026.9.12 |
评测结果 |
AAAATTTTTT |
| 题目名称 |
画线 |
最终得分 |
40 |
| 用户昵称 |
汐汐很希希 |
运行时间 |
6.614 s |
| 代码语言 |
C++ |
内存使用 |
5.22 MiB |
| 提交时间 |
2026-09-12 10:11:27 |
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
#define debug cout<<"?\n";
using namespace std;
const int N=1e6+10;
int n,q,ans=0,g[N];
bool check(int x,int y)
{
for(int i=x;i<=y;i++){
if(g[i]>y) return false;
else if(g[i]<x&&g[i]!=0) return false;
}
return true;
}
int main()
{
freopen("circle.in","r",stdin);
freopen("circle.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>q;
while(q--){
int x,y;
cin>>x>>y;
if(x>y) swap(x,y);
if(check(x,y)){
g[x]=y,g[y]=x;
cout<<"Yes\n";
}else cout<<"No\n";
}
return 0;
}