把v和2结点交换,

1和v连,其它点和v之间能够互相连。

#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std; int n,m,v,flag,i,cnt,j; int main()
{
while(~scanf("%d%d%d",&n,&m,&v))
{
flag=0;
if((n-1)*(n-2)/2+1<m) flag=1;
if(m<n-1) flag=1;
if(flag)
{
printf("-1\n");
continue;
}
cnt=n-1;
for(i=1;i<n;i++)
{
if(i==2) printf("%d ",v);
else if(i==v) printf("%d ",2);
else printf("%d ",i);
if(i+1==2) printf("%d\n",v);
else if(i+1==v) printf("%d\n",2);
else printf("%d\n",i+1);
}
for(i=2;i<n&&cnt!=m;i++)
{
for(j=i+2;j<=n&&cnt!=m;j++)
{
cnt++;
if(i==2) printf("%d ",v);
else if(i==v) printf("%d ",2);
else printf("%d ",i);
if(j==2) printf("%d\n",v);
else if(j==v) printf("%d\n",2);
else printf("%d\n",j);
}
}
}
return 0;
}

CodeForces 22C System Administrator的更多相关文章

  1. codeforces 22C System Administrator(构造水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud System Administrator Bob got a job as a s ...

  2. 解决方法:An error occurred on the server when processing the URL. Please contact the system administrator

    在WINDOWS7或SERVER2008上安装了IIS7.5,调试ASP程序时出现以下错误: An error occurred on the server when processing the U ...

  3. Requirements of an SAP system administrator

    Requirements of an SAP system administrator Have a "proper" attitude Protect and safeguard ...

  4. the account is currently locked out. The system administrator can unlock it.

    今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...

  5. 解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the system administrator

    原文:解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the syste ...

  6. SQL点滴8—the account is currently locked out. The system administrator can unlock it.

    原文:SQL点滴8-the account is currently locked out. The system administrator can unlock it. 今天遇到的问题比较有意思. ...

  7. The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator

    今天遇到一个案例,在使用命令修改一个测试服务器(SQL Server 2014标准版)的服务器排序规则时,遇到了下面错误信息 (具体账号信息脱敏处理,随机生成一个账号密码) The Windows a ...

  8. cvsnt报错:Administrator: Switch to user failed due to configuration error. Contact your System Administrator

    在安装CVSNT一开始用Administrator登录时总是报[login aborted]Switch to user failed due to configuration error. Cont ...

  9. Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)

    今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...

随机推荐

  1. 为YUM设置代理的方法

    http://momo-fedora.blog.163.com/blog/static/1161345982009329611312/

  2. java 一致性哈希类实例 算法

    package com.hash; import java.util.Collection; import java.util.SortedMap; import java.util.TreeMap; ...

  3. openstack 升级设计要求的指导原则

    不知道其他软件有没有类似的指导原则. Theory of Upgrade Grenade works under the following theory of upgrade. New code s ...

  4. Python-第一天

    1. 基础知识 1.1 编码 python默认是ascii编码,不支持中文 在脚本顶部添加 #coding=utf-8,使python支持中文 #!/usr/bin/env python    --- ...

  5. Drupal 7 建站学习手记(四):怎样改动Nivo Slider模块的宽高

    背景 Nivo Slider模块默认大小是用的height: 100%, width 100%, 但IE7及下面的浏览器是不支持百分比宽高的, 而我的项目目标用户基本都是使用XP系统,项目需求是必须兼 ...

  6. 从零开始Unity3D游戏开发【3烘焙】

    烘焙:通过烘焙能把动态场景转化为静态场景.从而提高游戏的性能. [烘焙步骤] 1.Edit---Player---Rendering[forword] 2.Directional light(必须是这 ...

  7. sql server 2005 表master..spt_values

    IF OBJECT_ID('tempdb..#t') IS NOT NULL DROP TABLE #tGOcreate table #t(id int identity,Dt varchar(10) ...

  8. 开发者工具console

    **(2)$0 - $4 ** 控制台保存了最近5个在Elements面板选中的DOM元素,$0代表倒数第一个,$1代表倒数第二个,以此类推直到$4. 按f12,就会出现开发者工具,然后在左上角有个放 ...

  9. JavaScript之面向对象学习四原型对象的动态性

    1.由于在原型中查找值的过程是一次搜索,因此我们对原型对象所做的任何修改都能够立即从实例上反映出来---即便是先创建了实例后修改原型也是如此.代码如下: function Person(){ } va ...

  10. 155Min Stack

    题目地址:155Min Stack 最近为了提高数据结构和算法能力,保证每天一到leetcode的题目.从easy开始,感觉这道题目还蛮好,记录一下. 题目大意:就是维护一个栈,获得栈中元素的的最小值 ...