HDU 6150 Vertex Cover(构造)
http://acm.hdu.edu.cn/showproblem.php?pid=6150
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn=+; const int n=;
struct node
{
int u,v;
}e[maxn]; int main()
{
//freopen("in.txt","r",stdin);
int cnt=n;
int e_cnt=;
for(int i=;i<=n;i++)
{
int num=n/i;
int left=;
for(int j=;j<=num;j++)
{
for(int k=;k<=i;k++)
{
e[e_cnt].u=left;
e[e_cnt].v=cnt+j;
e_cnt++;
left++;
}
}
cnt+=num;
}
printf("%d %d\n",cnt,e_cnt);
for(int i=;i<e_cnt;i++) printf("%d %d\n",e[i].u,e[i].v);
printf("%d\n",n);
for(int i=;i<=n;i++) printf("%d\n",i);
return ;
}
HDU 6150 Vertex Cover(构造)的更多相关文章
- HDU 6150 - Vertex Cover | 2017 中国大学生程序设计竞赛 - 网络选拔赛
思路来自 ICPCCamp /* HDU 6150 - Vertex Cover [ 构造 ] | 2017 中国大学生程序设计竞赛 - 网络选拔赛 题意: 给了你一个贪心法找最小覆盖的算法,构造一组 ...
- 2017中国大学生程序设计竞赛 - 网络选拔赛 HDU 6150 Vertex Cover 二分图,构造
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6150 题意:"最小点覆盖集"是个NP完全问题 有一个近似算法是说—每次选取度数最大 ...
- HDU - 6150 构造题
最近的vj好垃圾,老崩,实名吐槽 HDU - 6150 题意:给出一个错误的求最小点覆盖的函数,需要来构造一组样例,使得那个函数跑出来的答案是正解的3倍以上. 很巧妙的构造技巧,首先想法就是弄一个二分 ...
- PAT-1134 Vertex Cover (图的建立 + set容器)
A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at le ...
- 集合覆盖 顶点覆盖: set cover和vertex cover
这里将讲解一下npc问题中set cover和vertex cover分别是什么. set cover: 问题定义: 实例:现在有一个集合A,其中包含了m个元素(注意,集合是无序的,并且包含的元素也是 ...
- URAL 2038 Minimum Vertex Cover
2038. Minimum Vertex Cover Time limit: 1.0 secondMemory limit: 64 MB A vertex cover of a graph is a ...
- PAT1134:Vertex Cover
1134. Vertex Cover (25) 时间限制 600 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A vertex ...
- A1134. Vertex Cover
A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at le ...
- PAT A1134 Vertex Cover (25 分)——图遍历
A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at le ...
随机推荐
- 009-spring cloud gateway-过滤器GatewayFilter、GlobalFilter、GatewayFilterChain、作用、生命周期、GatewayFilterFactory内置过滤器
一.概述 在Spring-Cloud-Gateway之请求处理流程中最终网关是将请求交给过滤器链表进行处理. 核心接口:GatewayFilter,GlobalFilter,GatewayFilter ...
- 2.搭建cassandra时遇到没有公网网卡的问题
阿里云服务器有两种网络,一种是经典网络,一种是专用网络,经典网络是公网网卡的,但是专用网络是没有公网网卡的. 如图: 经典网络,公网ip是139.129.31.108: 专用网络,公网ip是 问题: ...
- AngularJS 表达式 对象和数组
AngularJS 使用 表达式 把数据绑定到 HTML. AngularJS 表达式 AngularJS 表达式写在双大括号内:{{ expression }}. AngularJS 表达式把数据绑 ...
- Mr Cao 的提问
block调用时,变量的生命周期有哪几种?分别是什么样的? 98.CALayer的多个sublaye的数据结构,以及重绘顺序? 99.网路请求的超时及重试机制应该如何设计? 100.NSDiction ...
- win 7 和 winserver 2008 下,布署网站遇到的错误解决方法
本人亲测,有效. 1.如果只列出目录: web.config的system.webServer配置节下是否有这个: <modules runAllManagedModulesForAllRequ ...
- \r与\n
\n是换行,英文是New line \r是回车,英文是Carriage return
- python之路 socket、socket server
一.socket socket的英文原义是“孔”或“插座”.作为BSD UNIX的进程通信机制,取后一种意思.通常也 称作"套接字",用于描述IP地址和端口,是一个通信链的句柄,可 ...
- Hive 数据类型转换
在Hive的日常使用中经常会遇到需要对字段进行数据类型转换的情况.Hive中的数据类型转换包括隐式转换(implicit conversions)和显式转换(explicitly conversion ...
- 硬件中断和DPC一直占40-52%左右 解决方法
硬件中断和DPC一直占40-52%左右,突然感觉电脑变慢 重启后竟然启动不了了,冷却一段时间后才能进去,温度检测cpu,硬盘都超标了! 用Process Explorer检测硬件中断和DPC 占cpu ...
- OpenCV-跟我一起学数字图像处理之拉普拉斯算子
https://www.cnblogs.com/german-iris/p/4840647.html Laplace算子和Sobel算子一样,属于空间锐化滤波操作.起本质与前面的Spatial Fil ...