【题目链接:J-堆

1734: 堆

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 239  Solved: 113

SubmitStatusWeb Board

Description

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAABICAIAAACBXQaVAAAgAElEQVR4nO2d308T2f//+wf0ppe9MCFpmvSiiTENFxBj2os2GhJK3DQEJA2YNUDea4C3sdWN4GYtbt7U7G6bt1be60Ql/qi7nfB+W10RqQoYykpdS6DRYQVthXGhQulnaAqd9sz3YqbtdDr9BXV1/Z7HldR2Zs6Z8+N5Xq/XeR0BBYFAIBAIBAIpK4KP/QAQCAQCgUAgnxtQYEEgEAgEAoGUGSiwIBAIBAKBQMoMFFgQCAQCgUAgZQYKLAgEAoFAIJAyAwUWBAKBQCAQSJmBAgsCgUAgEAikzECBBYFAIBAIBFJmoMCCQCAQCAQCKTNQYEEgEAgEAoGUGSiwIBAIBAKBQMrM31hgAeLVs7l18LEfI4M4SZIkyX0mQJIkScY/yhP9XeGvSS6AJOPxwl/LJBENLQcJsuRHIvHpZ4Hop9XgPm8AScYB7DmQvwwQJ+MJ2OI+AnGSBHEy/mkMryAaevduO3NEFh9RYEXmhhwj2GpGISLT9nPXxgKRYn4+b2+XSo8gsx9CYyXCrpNi8UlXOEFRFCAC0x4+sCDnDSQwRMP8KoohOoEGwRIURQVdhmoN8iLBf6+tgPMb/Qln4AM2rc0g9py3BEnmgnwiJYEhGoEOwaJ818yoou0BiBeD/YOzBM9wxqrJPOR/hhjudlweehGhKIokgvh7gikj7+sgCfyl23nZbDh8eOAl3+XiaxN9KuGe5ouTK4UFXTzkG0FzMuILsYpMEkG8SLL7fCk3Khfg7dB35255l/MOPyAWmBzM/WQoOnjft1qoHkNuk1LYYPfn+x4ZdA/0WV1v098J+wYvX3/y7LfL330/9u6jDthBl0EhNrjCFEVRcSIww9f1nmPBzZ3dBZDBuby9m/8W2+vdIOS7v6N3uq0S4ve/O/uLdyV/RUUD7jv5Wlwx3SEyYZJLG+wLeUoBgm6k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5muZ+gsirz2BE8SvhEsuee45Bz9v/uaN3Zsv3RUTRuc0oMXDGmDVHzIYblhKkWrjxrEDzVsbMrad+wX/QHqjpHSFpwIBFXF8qkdcasT92sDIXLHsGd9vAm6T7p66Wxsb2izjxof/a5QfXPHNAf4IAAAGUSURBVBALL2/7J6OS1OvZeW7n3x2fgNsraxfqJIXPGQsvr2yzwcRbHTdBzv43XHDzMEAFJj2TM6Ed/f2tfMeJra9sYa3YgntcWPv5CwGo4PJWbiL9vZ09IBALL5PFfz8VCwezhzRY8Qzen86eJeQ/007/hNpfFDpEeDzemTfie0luhBYD5HpmeAkzwyAW3mrk/UXZ5n3ZtdPSoRlPzvsONkKvA8uC15PeoDbTW7vEwqu74Jf+3nykv5MOgUAgEMgHB2oeBAKBQPYKUPMgEAgEsleAmgeBQCCQvQLUPAgEAoHsFaDmQSAQCGSvADUPAoFAIHsFqHkQCAQC2StAzYNAIBDIXgFqHgQCgUD2ClDzIBAIBLJXgJoHgUAgkL0C1DwIBAKB7BWg5kEgEAhkrwA1DwKBQCB7Bah5EAgEAtkrQM2DQCAQyF4Bah4EAoFA9gpQ8yAQCASyV4CaB4FAIJC9AtQ8CAQCgewVoOZBIBAIZK8ANQ8CgUAgewWoeRAIBALZK0DNg0AgEMheAWoeBAKBQPYK/w+WP36XXPcBeQAAAABJRU5ErkJggg==" alt="" />

Sample Input

3
1
10
3
10 5 3
1 2
1 3
5
1 2 3 4 5
3 1
2 1
2 4
2 5

Sample Output

Yes
No
Yes

【思路】

  堆:堆最重要的性质就是儿子的值一定不小于父亲的值。除此之外,树的节点是按从上到下、从左到右的顺序紧凑排列的。

    本题的堆是一种叫做二叉堆的数据结构。

    《挑战程序设计》 P71

  对于这题,首先要模拟出二叉树的结构,根据题意通过value[]保存每个节点的权值(值)

       再将每两节点之间是否有边连接,保存为tree[][],通过输入的两节点a,b,即保存tree[a][b] = 1

       1. 在接下来的深搜中,只需搜索tree[][] == 1的节点

       2. 同时,在搜索中还需要满足最小堆(堆)的性质,即value[节点] <= value[子节点]

       若符合以上1.2两个条件,则继续向深处(子节点)搜索

          即dfs(深度优先搜索)的性质:列举出所有可能,每种可能搜索至,直到边界,或不符合条件为止。(不撞南墙不回头)

       依旧,还需要一个数组来保存,当前的节点是否被搜索过,即see[] = 1

 #include<iostream>
#include<cstring>
using namespace std;
#define Max(a,b) (a > b ? a : b)
#define Min(a,b) (a < b ? a : b)
const int MAXN = ;
int value[MAXN],tree[MAXN][MAXN],see[MAXN],ac,m;
void dfs(int k){
see[k] = ; //表示已搜过
for(int j = ;j <= m;j++){
if(tree[k][j] && !see[j]){ //没搜索过,并且两节点间存在边
if(value[k] <= value[j]) //当前节点权值小于或等于它的子节点权值
dfs(j);
else
ac = ;
}
}
}
int main(){
int n;
scanf("%d",&n);
while(n--){
memset(tree,,sizeof(tree));
memset(see,,sizeof(see));
int i;
cin >> m;
for(i = ;i <= m;i++){
cin >> value[i];
}
for(i = ;i < m;i++){
int a,b;
cin >> a >> b;
//tree[a][b] = 1; 如果这样,那么:
// 1 2 与 1 2
// 1 4 1 4
// 4 3 3 4
// 4 5 4 5
// 结果为前者是Yes 后者为 No
//应为:
tree[a][b] = ;
tree[b][a] = ;
}
ac = ;
dfs();//从根节点开始
cout << (ac ? "No" : "Yes") << endl;
//printf(ac ? "No\n" : "Yes\n") ;
}
return ;
}

  

【DFS+堆的二叉树结构】15轻院校赛-J-堆的更多相关文章

  1. 【二叉树、堆】15轻院校赛-J-堆

    原题:http://acm.zzuli.edu.cn/problem.php?cid=1099&pid=9 [描述] [输入] [输出] Sample Input 3 1 10 3 10 5 ...

  2. 2015轻院校赛 B 迷宫 (bfs)

    http://acm.zznu.edu.cn/problem.php?id=1967 这套题的有毒   我交了好多遍才对 坑:机关要按照顺序走 并且在走这个机关之前不能走这个机关  但是能穿过这个机关 ...

  3. 2015轻院校赛 D 社交网络(排列组合)

    http://acm.zznu.edu.cn/problem.php?id=1964 题目描述 输入 输出 样例输入 2 2 1 0 1 1 0 3 1 0 1 1 1 0 1 1 1 0 样例输出 ...

  4. 轻院校赛-zzuli 2266: number【用每位的二进制的幂的和来进行hash(映射)处理】

    zzuli 2266: number 大致题意:   给定n,问有多少数对<x, y>满足: x, y∈[1, n], x < y            x, y中出现的[0, 9] ...

  5. python数据结构与算法——二叉树结构与遍历方法

    先序遍历,中序遍历,后序遍历 ,区别在于三条核心语句的位置 层序遍历  采用队列的遍历操作第一次访问根,在访问根的左孩子,接着访问根的有孩子,然后下一层 自左向右一一访问同层的结点 # 先序遍历 # ...

  6. C语言实现哈夫曼编码(最小堆,二叉树)

    // 文件中有通过QT实现的界面#include <stdio.h> #include <stdlib.h> #include <string.h> typedef ...

  7. 结构之美——优先队列基本结构(四)——二叉堆、d堆、左式堆、斜堆

    实现优先队列结构主要是通过堆完成,主要有:二叉堆.d堆.左式堆.斜堆.二项堆.斐波那契堆.pairing 堆等. 1. 二叉堆 1.1. 定义 完全二叉树,根最小. 存储时使用层序. 1.2. 操作 ...

  8. 【高频Java面试题】简单说说JVM堆的内存结构和GC回收流程

    目录 前言 JVM堆内存结构简述 JVM堆内存结构图 堆初体验 结构详情 新生代 老年代 永久代/元空间 GC回收流程 GC回收流程图 GC回收详细流程 查看JDK自带可视化堆空间图 总结 前言 我们 ...

  9. C++二叉树结构的建立和操作

    二叉树是数据结构中的树的一种特殊情况,有关二叉树的相关概念,这里不再赘述,如果不了解二叉树相关概念,建议先学习数据结构中的二叉树的知识点. 准备数据 定义二叉树结构操作中需要用到的变量及数据等. #d ...

随机推荐

  1. C# 虚方法 与 隐藏方法(new) 区别

    重写和隐藏的定义: 重写:继承时发生,在子类中重新定义父类中的方法,子类中的方法和父类的方法是一样的          例如:基类方法声明为virtual(虚方法),派生类中使用override申明此 ...

  2. [51 nod]1009 数字1的数量

    1009 数字1的数量 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个数.   例如: ...

  3. c# 与 Unity3d 中的序列化

    圣典中对于Unity3D的序列化介绍很容易和C#的序列化介绍搞混,做个笔记,方便以后查找. 很多资料算是拾人牙慧. 一.Serializable 序列化 Inherits from Attribute ...

  4. 使用getScript()方法异步加载并执行js文件

    使用getScript()方法异步加载并执行js文件 使用getScript()方法异步请求并执行服务器中的JavaScript格式的文件,它的调用格式如下所示: jQuery.getScript(u ...

  5. application.xml定时

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  6. HTML5入门3---视频播放器

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta na ...

  7. parent children

    class parent{ protected static int count=0; public parent() { count++; } } public class child extend ...

  8. public View getView(int position, View convertView, final ViewGroup parent)三个参数的意思

    最近看到有人在问这三个参数的含义,其实帮助已经很详细的介绍了这三个参数,看来还是要好好学学英语了,不然连解释都看不懂. /**     * Get a View that displays the d ...

  9. Zookeeper核心机制

    (如果感觉有帮助,请帮忙点推荐,添加关注,谢谢!你的支持是我不断更新文章的动力.本博客会逐步推出一系列的关于大型网站架构.分布式应用.设计模式.架构模式等方面的系列文章) Zookeeper是Hado ...

  10. cas单点登出

    由于项目需求要实现单点登出需要在网上找了N久终于实现单点登出. 使用cas-server-core-3.3.3.jar(CAS Server 3.3.3) 使用cas-client-core-3.1. ...