「日常训练」Regular Bridge(Codeforces Round 306 Div.2 D)
2024-09-04 16:40:47
题意与分析
图论基础+思维题。
代码
#include <bits/stdc++.h>
#define MP make_pair
#define PB emplace_back
#define fi first
#define se second
#define ZERO(x) memset((x), 0, sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define rep(i, a, b) for (repType i = (a); i <= (b); ++i)
#define per(i, a, b) for (repType i = (a); i >= (b); --i)
#define QUICKIO \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
using namespace std;
using ll=long long;
using repType=int;
int main()
{
int k; cin>>k;
if(k%2==0) cout<<"NO"<<endl;
else
{
cout<<"YES"<<endl;
cout<<4*k-2<<" "<<2*k*(k-1)+k<<endl;
cout<<1<<" "<<2<<endl;
rep(i,3,3+k-1-1) cout<<1<<" "<<i<<endl;
rep(i,k+2,k+2+k-1-1) cout<<2<<" "<<i<<endl; // k+2 ~ 2*k
rep(i,3,3+k-1-1)
{
rep(j,2*k+1,2*k+1+k-1-1) // 2*k+1 ~ 3*k-1
{
cout<<i<<" "<<j<<endl;
}
}
rep(i,k+2,2*k)
{
rep(j,3*k,3*k+k-1-1) // 3*k ~ 4*k-2
{
cout<<i<<" "<<j<<endl;
}
}
for(int i=2*k+1;i<=3*k-1;i+=2)
{
cout<<i<<" "<<i+1<<endl;
}
for(int i=3*k;i<=4*k-2;i+=2)
{
cout<<i<<" "<<i+1<<endl;
}
}
return 0;
}
最新文章
- Linux入门之路
- postgresql+slony-i安装配置主从
- KnockoutJS 3.X API 第四章 表单绑定(8) submit、enable、disable绑定
- mysql中变量赋值
- PHP设计模式(一)
- POJ 3628 Bookshelf 2【01背包】
- enumerate
- OC6_代理的基本概念
- Project Euler 77:Prime summations
- jqueryeasyui中文乱码问题
- C语言基础学习运算符-赋值运算符
- 线段树解决leetcode307. Range Sum Query - Mutable
- 缩放系列(一):一个很好的bitmap手势缩放demo(多点触控)
- Ubuntu里字符编码设置
- lufylegend库 LBitmapData LBitmap LSprite
- C#访问C++动态分配的数组指针
- 浏览器输入url回车后,会发生什么?
- hbase单机版安装+phoneix SQL on hbase 单节点安装
- Linux下密码抓取神器mimipenguin
- ORA-01552 非系统表空间不能使用系统回滚段处理
热门文章
- PHP数组和字符串相互转换以及判断字符串长度
- Mysql优化实践(分页优化)
- mac终端terminal快捷键
- building for production...Killed
- POJ 1328 Radar Installation(很新颖的贪心,区间贪心)
- Impossible WHERE noticed after reading const tables
- Python 学习笔记(九)Python元组和字典(三)
- 20181030NOIP模拟赛T3
- centos7.3上编译安装percona5.7.18
- 关于Hibernate的部分知识总结