主题链接:pid=2454">http://acm.hdu.edu.cn/showproblem.php?pid=2454 Problem Description Wang Haiyang is a strong and optimistic Chinese youngster. Although born and brought up in the northern inland city Harbin, he has deep love and yearns for the bound…
///已知各点的度,推断是否为一个简单图 #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int a[1010]; bool cmp(int x,int y) { return x>y; } int main() { int t,n,i,j; scanf("%d",&t); while(t--) { int flag=1; sca…
传送门 参考资料: [1]:图论-度序列可图性判断(Havel-Hakimi定理) •题意 给你 n 个非负整数列,判断这个序列是否为可简单图化的: •知识支持 握手定理:在任何无向图中,所有顶点的度数之和等于边数的2倍: 推论:任何图,奇度顶点的个数为偶数: 可图化定理:非负整数序列 $d={d_1,d_2,\cdots,d_n}$ 是可图化的当且仅当 $\sum_{i=1}^{i \leq n}d_i$ 为偶数: 简单图:既不含平行边,也不含环: 平行边:在无向图中,如果关联一对顶点的无向边…
题意 给你一个度序列,问能否构成一个简单图. 分析 对于可图化,只要满足度数之和是偶数,即满足握手定理. 对于可简单图化,就是Heavel定理了. Heavel定理:把度序列排成不增序,即 $deg[1] \geq deg[2] \geq ... \geq deg[V]$,则 $deg$ 可简单图化当且仅当 ${deg}' = \{deg[2]-1, deg[3]-1,...,deg[deg[1]+1]-1,...,deg[v] \}$ 可简单图化. 简单地说,把 $deg$ 从大到小排序后,找…
传送门 •Havel-Hakimi定理: 给定一个非负整数序列{d1,d2,...dn},若存在一个无向图使得图中各点的度与此序列一一对应,则称此序列可图化. 进一步,若图为简单图,则称此序列可简单图化. 定理描述: 由非负整数组成的有限非递增序列,S={d1,d2,d3...dn},当且仅当S1={d2-1,d3-1...d(d1+1),d(d1+2)......dn}也是可图的, 也就是说,序列S1也是由非负整数组成的有限非递增序列,S1是由S的删除第一个元素d1之后的前d1个元素分别减一后…
Problem Description Wang Haiyang is a strong and optimistic Chinese youngster. Although born and brought up in the northern inland city Harbin, he has deep love and yearns for the boundless oceans. After graduation, he came to a coastal city and got…
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=2454 [别人博客粘贴过来的] 博客地址:https://www.cnblogs.com/debugcool/archive/2011/04/23/HDOJ2454.html 一句话,顶点的度序列 Havel 定理~ 定义:给出一个无向图的顶点度序列 {dn},要求判断能否构造出一个简单无向图. 分析: 贪心的方法是每次把顶点按度大小从大到小排序,取出度最大的点Vi,依次和度较大的那些顶点Vj连接…
http://acm.uestc.edu.cn/#/problem/show/913 握手 Time Limit: 2000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit Status 一群人参加了一次聚会,其中有一些人是好朋友.一对朋友见面后握手且仅握一次手,并且每个人不会和自己握手(废话!).现在告诉你每个人一共握了几次手,请你判断是否存在一种朋友关系满足每个人的握手数. Input 输入多…
Graph Reconstruction Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Let there be a simple graph with N vertices but we just know the degree of each vertex. Is it possible to reconstruct the graph only by these information? A sim…
HDU 1560 DNA sequence(DNA序列) Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)   Problem Description - 题目描述 The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. Th…