/*
只要找到两个没有关系的点即可
*/
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
long long n,m;
int a[maxn],b[maxn];
vector<int>G[maxn];
int main(){
cin>>n>>m;
if(n==){
puts("NO");
return ;
}
if(n*(n-)/<=m){
puts("NO");
return ;
}
puts("YES"); /* if(n==2){
puts(" ");
puts("1 2");
puts("1 1");
return 0;
}
*/
for(int i=;i<=m;i++){
int a,b;
cin>>a>>b;
G[a].push_back(b);
G[b].push_back(a);
}
for(int i=;i<=n;i++)G[i].push_back(i);
for(int i=;i<=n;i++)
sort(G[i].begin(),G[i].end()); int pos1,pos2;
for(int i=;i<=n;i++){
if(G[i].size()==n)continue;
for(int j=;j<=G[i].size();j++)
if(j!=G[i][j-]){
pos1=i;pos2=j;
break;
}
}
int i=;
for(int j=;j<=n;j++)
if(j==pos1)cout<<n<<" ";
else if(j==pos2)cout<<n-<<" ";
else cout<<++i<<" ";
puts("");
i=;
for(int j=;j<=n;j++)
if(j==pos1 || j==pos2)cout<<n-<<" ";
else cout<<++i<<" ";
}

思维构造——cf1090D的更多相关文章

  1. hdu4671 思维构造

    pid=4671">http://acm.hdu.edu.cn/showproblem.php? pid=4671 Problem Description Makomuno has N ...

  2. 思维/构造 HDOJ 5353 Average

    题目传送门 /* 思维/构造:赛后补的,当时觉得3题可以交差了,没想到这题也是可以做的.一看到这题就想到了UVA_11300(求最小交换数) 这题是简化版,只要判断行不行和行的方案就可以了,做法是枚举 ...

  3. Pythagorean Triples毕达哥斯拉三角(数学思维+构造)

    Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pytha ...

  4. A Mist of Florescence CodeForces - 989C(思维构造)

    题意: 让你构造一个图,使得A,B,C,D的个数为给定的个数,上下左右连通的算一个. 哎呀 看看代码就懂了..emm..很好懂的 #include <bits/stdc++.h> usin ...

  5. Educational Codeforces Round 53C(二分,思维|构造)

    #include<bits/stdc++.h>using namespace std;const int N=1e6+6;int x[N],y[N];int sx,sy,n;char s[ ...

  6. 牛客多校训练第八场C.CDMA(思维+构造)

    题目传送门 题意: 输入整数m( m∈2k ∣ k=1,2,⋯,10),构造一个由1和-1组成的m×m矩阵,要求对于任意两个不同的行的内积为0. 题解: Code: #include<bits/ ...

  7. Atcoder C - +/- Rectangle(思维+构造)

    题目链接:http://agc016.contest.atcoder.jp/tasks/agc016_c 题解:挺简单的构造,很容易想到的构造方法就是(h*w)的小矩阵里其他值赋值为1,最后一个赋值为 ...

  8. AtCoder - 2282 (思维+构造)

    题意 https://vjudge.net/problem/AtCoder-2282 告诉你sx,sy,tx,ty,问从s走到t,再从t走到s,再从s走到t,再从t回到s的最短路,每次只能上下左右选一 ...

  9. ACM-ICPC 2018 青岛赛区现场赛 D. Magic Multiplication && ZOJ 4061 (思维+构造)

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4061 题意:定义一个长度为 n 的序列 a1,a2,..,an ...

随机推荐

  1. keep-alive用法及(activated,deactivated生命周期)

    <template> <div id="app"> <!-- <img src="./assets/logo.png"> ...

  2. 读书笔记---《Docker 技术入门与实践》---为镜像添加SSH服务

    之前说到可以通过attach和exec两个命令登陆容器,但是如果遇到需要远程通过ssh登陆容器的场景,就需要手动添加ssh服务. 下面介绍两种方法创建带有ssh服务的镜像,commit命令创建和通过D ...

  3. Dubbo管理端工具

    要得到dubbo的管理端工具其实很简单,只需要下面几步: 1.下载源码:我下载的是dubbo-dubbo-2.5.7.zip . 2.使用maven命令编译源码,得到war包: 将下载的dubbo-d ...

  4. pandas 索引、选取和过滤

    Series索引的工作方式类似于NumPy数组的索引,不过Series的索引值不只是整数,如: import numpy as np import pandas as pd from pandas i ...

  5. zeromq protobuf例子

    https://github.com/AifiHenryMa/zeromq_protocolbuffer_demo https://github.com/protocolbuffers/protobu ...

  6. backface-visibility:hidden

    backface-visibility:hidden 不面向屏幕时隐藏

  7. 45. Collection

    因为Collection是接口我们不能直接实例化,所以我们下面的例子都是采用多态实例化实现类ArrayList类 1. Collection中常用方法 添加:    add()  添加一个元素到集合中 ...

  8. xpath总结

    Python包 pip install lxml 在 XPath 中,有七种类型的节点:元素.属性.文本.命名空间.处理指令.注释以及文档(根)节点.XML 文档是被作为节点树来对待的. xpath语 ...

  9. webpack 配置es6 语法

    使用babel来编译es6的语法; 1.在终端上输入指令 npm install webpack babel-loader babel-core babel-preset-es2015 --save- ...

  10. CSS——浮动及应用&清除浮动

    浮动(float) 1.普通流(normal flow) 这个单词很多人翻译为 文档流 , 字面翻译 普通流 或者标准流都可以. 前面我们说过,网页布局的核心,就是用CSS来摆放盒子位置.如何把盒子摆 ...